The 2024 Developer Survey results are live! See the results

# Questions tagged [recursion]

For challenges involving recursive functions, or functions or programs calling itself, directly or indirectly.

40 questions
Filter by
Sorted by
Tagged with
531 views

### Situations when recursion helps [closed]

Recursion is actually quite powerful, sometimes its doesn't look like that child problem of itself exist, but recursion is just helpful. One case per answer.
• 25.5k
1k views

### Number of cigarettes that can be made from a given number of butts

Assumption A cigarette can be made by combining four cigarette butts. Cigarette butts last infinitely until smoked. Explanation Say you have 31 butts. That means, you can make 7 cigarettes from 28 ...
1k views

1k views

### Recursive Steiner Chains

Steiner Chains are a set of N circles where each circle is tangent to 2 other non-intersecting circles as well as the the previous and next circles of the chain, as seen in the below images: In ...
• 2,502
5k views

Inspired by Alex's glorious Learn you an R for great good, we are going to humbly recreate Alex's "one true R program" -- but with a twist. Alex-style Addition works like this -- it has a 90% chance ...
• 11.2k
4k views
+200

### Tiny Lisp, tiny interpreter

Lisp programmers boast that Lisp is a powerful language which can be built up from a very small set of primitive operations. Let's put that idea into practice by golfing an interpreter for a dialect ...
• 40k
648 views

### Prefix Tree Traversal

Write a program that takes in (via stdin or command line) a string with the recursive form PREFIX[SUFFIXES] where PREFIX may ...
• 89.9k
2k views

### Print, Increment, Decrement, Alias - Interpret Prindeal

Prindeal (pronounced prin-dee-al) is a new esoteric programming language that only has four commands: print, increment, decrement, and alias. Despite its minimalism, complex mathematical operations ...
• 89.9k
2k views

### Evaluating Parentheses and Brackets as Integers

Write a program that takes in a string of the four characters ()[] that satisfies these points: Every left parenthesis ( has a ...
• 89.9k
4k views

### Ways to arrange the integers 1 to 9 with operators so that the result is 100

Prelude: This task is taken from Five Problems Every Software Engineer Should Be Able to Solve in Less Than an Hour, which I really recommend. The task: Write a program that outputs all possibilities ...
• 2,073
The Ackermann function is notable for being the one of the simplest examples of a total, computable function that isn't primitive recursive. We will use the definition of $A(m,n)$ taking in two ...