Continued fractions of the square roots of non-square integers are periodic. The period itself is a palindrome followed by twice the first term:

sqrt(5) = [2; 2,4, 2,4, 2,4,...]

sqrt(13) = [3; 1,1,1,1,6, 1,1,1,1,6, ...]

sqrt(29) = [5; 2,1,1,2,10, 2,1,1,2,10, ...]

sqrt(31) = [5; 1,1,3,5,3,1,1,10, 1,1,3,5,3,1,1,10, ...]

Seefor more details about continued fractions.http://mathworld.wolfram.com/ContinuedFraction.html

This proggy uses that fact to check serial numbers. The code takes an integer and verifies that the continued fraction representation of its square root matches the following checks:

Each term in the continued fraction except the first and last must be a number between 1 and 27, where 27 indicates a space, and 1-26 are A-Z. The first five are CACCG, while the last five are (of course) GCCAC. The middle ones encode the username forwards and backwards.

For example,

sqrt(serial) =

[(x); C,A,C,C,G,M,I,K,E,E,K,I,M,G,C,C,A,C,(2*x), ...]

In order to win this one, you've got to post a serial with your handle in it.

Easy question: Why CACCG?

## Bookmarks