Problem 43650. Church Encoding

Created by Kensuke Fujita in Community

Church encoded numeral is a function which takes two arguments f and x and applies f to x several times.

For example, if c is a church numeral 3, then the following holds. c(f,x) = f(f(f(x)))

Write a function named church(n). Input n is an nonnegative integer. Output is the church encoded numeral of n.

Solution Stats

72.41% Correct | 27.59% Incorrect
Last solution submitted on Feb 10, 2019

Problem Comments

Recent Solvers11

Suggested Problems

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!