Eat the Chickpeas
"Leblebi"
Leblebi is a popular snack in the Middle East, particularly in Turkey, made from roasted chickpeas. The chickpeas are dried and then roasted until they achieve a crunchy texture. Leblebi can be found in various flavors, including salted, spiced, or coated with a layer of candy. It is commonly consumed as a healthy, protein-rich snack or used as an ingredient in mixtures with nuts and other dried fruits.
Bilal has n chickpeas in his hand. He can eat these chickpeas by popping them into his mouth one at a time or two at a time. How many different ways can Bilal eat all the n chickpeas he has?
For example, if Bilal has 3 chickpeas, he can eat them in 3 different ways: 1,1,1 / 2,1 / 1,2.
We wanted to solve this problem using a computer. We created the solution table with the help of the following C code.
#include<stdio.h>
int leb(int n)
{
if(n==0) return 0;
if(n==1) return 1;
return (leb(n-1)+leb(n-2));
}
int main()
{
int n;
scanf("%d",&n);
printf("%d",leb(n));
return 0;
}
The computer we used to solve this problem is equipped with an Intel Pentium dual-core E2200 processor, 1 GB of RAM, a 100GB hard drive, and runs on Linux Ubuntu.
For 4 chickpeas, the result is 5;
for 5 chickpeas, the result is 8.
As can be seen, the Fibonacci sequence emerges once again.
The solution we had the computer run took 9 minutes for n=50.
How many days would it take you to solve it? If you can solve it in a shorter amount of time, please send us an email.