After a long time in-door researched, Hung found a good approach to attract a girl and he named it “Girl attracting law by Fibonacci approach” that means the number of presents Hung gives to her is increased by Fibonacci sequence. But don’t stop, he extended to version 2 with some customisation by:
T(n+2) = T(n+1) * T(n+1) + T(n)
with T(n) is a number of presents at the nth dating.
Hung of course has a lot of money but wants to trust a girl, so he should give her 0 present at the first and 1 present at the second dating. And following his theory, 5 presents should be given in the 5th dating as explanation below:
1st number = 0
2nd number = 1
3rd number = 12 + 0 = 1
4th number = 12 + 1 = 2
5th number = 22 + 1 = 5
Hung said that he has meet her 13 times and today he wants to know how many present he should give. Could you help Hung?
It seems very easy because the Fibonacci is a basic problem we usually do in learning programming. But, please aware that the number in this sequence increase too fast and need a wide range of positive number. In C# or Java, you could use BigInteger type.
public class GirlAttracion
public static void Main( string args )
BigInteger a = 0;
BigInteger b = 1;
for ( int i = 2; i < 14; i++ )
BigInteger c = BigInteger.Pow( b, 2 ) + a;
a = b;
b = c;
Console.WriteLine( b );
454 total views, 2 views today