# Problem 338 (2)

Damn, this problem is really difficult!

There is something to do with parity of arguments in function F, but I haven’t solved what exactly yet. I know that if both arguments are odd, then the result is 0. I am also considering cases when one of the arguments is odd and the other is even and I have spotted that results repeat periodically. For given a, the period starts at b given below and looks as follows:

a = 1 b >= 4 [1]

a = 3 b >= 10 [2 ,3]

a = 5 b >= 14 [1, 2, 2, 2, 1, 3]

a = 7 b >= 18 [2, 1, 1, 3, 1, 1, 2, 2, 1, 2, 1, 2]

a = 9 b >= 26 [2, 3, 3, 4, 2, 3, 2, 5, 2, 3, 2, 4, 3, 3, 2, 4, 2, 4, 2, 4]

I have also spotted that periods are palindromic.

Anyway, even if I implemented a structure to remember periods and used already calculated values, I would have to do this for all a < 10^12, which may take A BIT more than one minute. I really would like to know how to solve this problem in a minute.

Posted on June 9, 2011, in Project Euler. Bookmark the permalink. Leave a comment.

## Leave a comment

## Comments 0