- Take the last digit of your age, multiply it by 2, then for every decade you've lived add 1 to it. Color this result
**Blue**in your mind - Think of your favorite digit, any digit at all, multiply it by 11.
- Add the last digit of your age to the previous result.
- For every decade you've lived subtract 1 from the previous result. This is your
**Red**number.

__Alright, now tell me your Blue and Red numbers and I will guess your age!__

© 2008 by Thoreaulylazy. All Rights Reserved.

__Spoilers:__Are you sure? It could be a lot of fun to figure out the trick yourself...

Yes, I'm sure.

Don't say you haven't been warned.

I won't.

You're very persistent. Are you sure you don't have any psychological problems?

Just show me the spoilers already!!! AARRGH.

I tried to warn you earlier, remember?

Sigh.

What is the airspeed velocity of an unladen swallow?

** Spoilers**:

*?*

**Why did you waste your time like this**For starters, I was sick and bedridden for the day, so it wasn't as if I had many productive alternatives. Secondly, I was inspired through the sheer level of disgust the trick "Your Age by Eating Out" instilled in me. To save you the trouble of reading about that other trick elsewhere, I'll give you the gist of it. It's a puzzle that makes you compute

`(2*randDigit + 5)*50 + (bdayThisYear?1757:1756) - DOB`

. Yes, I was rather aghast at having to subtract my date of birth, especially from a number that differed by one depending on whether or not I had my birthday this year. What sort of 'puzzle' is this when it's the spanking facsimile of how age is normally computed? Unfortunately, if you view the google hits when searching for that puzzle, you'll find – almost without exception – glowing reviews of how *amazing*the puzzle is. I needed to right this travesty of mathematics, and so I devised a puzzle that could baffle nearly anyone who wasn't a math or cs major, and managed to successfully validate this claim on a sample of well-educated engineers.

**?!**

*How did you get my age*Well, age = ( 77*(Blue

`div`

2) + 770*(Blue%2) + 133*Red ) % 209*?*

`77, 770, 133, 209`

? .. Where do these numbers come from, and why do they workWell, I first picked a number theory topic. A popular one is the Chinese Remainder Theorem, which states that, for an unknown x, if x % p

_{i}is known for each prime p

_{i}in some sequence of primes p, then x can be solved in the domain 0..Π(p)-1. This is powerful because the domain grows factorially: an innocuous sequence of small primes, like 11 and 19 can solve an integer in the range 0..(11*19-1) = 0..208. That is, if I knew what the modulo of someone's age was with respect to 11 and 19, then I can solve their age for anyone aged between 0 and 208. I chose 11 and 19 because 10 ≡ -1

`mod 11`

and 20 ≡ 1 `mod 19`

, which means I can easily harness people's comfort with base 10 to extract information regarding their age modulo primes 11 and 19. Moreover, such simultaneous congruences are fun because they're very similar to a system of linear equations, except middle schoolers are well-acquainted with solving SLEs whereas simultaneous congruences are tackled usually only in math and computer science baccalaureate curricula. In order to read the text below, you should understand modulos and the totient function.Blue = 2 * (age % 10) + (age

`div`

10)Red = 11r + (age % 10) - (age

`div`

10)age % 19 ≡ age - k

_{1}*19 ≡ age - k

_{1}*20 + k

_{1}≡ (age % 20) + (age

`div`

20) ≡ (age % 10) + (age `div`

20) + 10*((age `div`

10)%2) ≡ (Blue `div`

2) + 10*(Blue%2) `mod 19`

age % 11 ≡ age - k

_{2}*11 ≡ age - k

_{2}*10 - k

_{2}≡ (age % 10) - (age

`div`

10) ≡ Red. `mod 11`

We can express age in terms solely of Blue and Red:

age = Σ

_{∀pi∊p}( (age%p

_{i})*(Π(p)/p

_{i})

^{φ(pi)})

= ( (age%19)*(Π(p)/19)

^{φ(19)}+ (age%11)*(Π(p)/11)

^{φ(11)}) % Π(p

_{i})

= ( (age%19)*11

^{18}+ (age%11)*19

^{10}) % 209

= ( (age%19)*77 + (age%11)*133 ) % 209

= ( ((Blue

`div`

2) + 10*(Blue%2))*77 + Red*133 ) % 209= ( 77*(Blue

`div`

2) + 770*(Blue%2) + 133*Red ) % 209