Mr. X and Mr. Y live in the same avenue with only 9 houses between them. The number on their houses were both prime, and Mr. X found that he could express the number of his house as the sum of the squares of the digits of Mr. y's house number.
What were their house numbers ?
At first I believed there was 20 between the houses. After a while of checking and rechecking I just had to look at Charlie’s solution and surprised to find there was no solution. Does anyone live where houses aren’t separated by 2?
Anyhows my approach was (quite) easily modified to accommodate a difference of 10.
1 digit case
If Y lives at house, # a
X must live at #a^2
a^2>a (for all a in H)
so a^2a = 10
which clearly can’t work for a to be a whole house number
2 digit case
Y lives at # ab
X lives at a^2 + b^2
So either
i) (a^2 + b^2) –ab = 10 (Mr X’s number is bigger)
ii) ab – (a^2 + b^2) = 10 (Mr Y’s number is bigger)
i) Mr X’s number is bigger: (a^2 + b^2) – ab = 10
rearranged,(a^2 – 10a) + (b^2b) = 10
b can’t be even (would make ab nonprime)
hence
(b^2b) = 6 (b=3)
20 (b=5)
42(b=7)
72(b=9)
so, (a^2 – 10a) = 4, 10, 32, 62
but (a^2 – 10a) has a minimum value of 25 (when a=5) and is always negative hence
(a^2 – 10a) = 10
and this doesn’t hold for any a
ii) Mr Y’s number is bigger: ab  (a^2 + b^2) = 10
rearranged ,(10a – a^2) + (b – b^2) = 10
again, b is odd so,
(b – b^2) =  6 (b=3)
20 (b=5)
42(b=7)
72(b=9)
so, (10a – a^2) = 16, 30, 52, 82
but (10a – a^2) has a maximum value of 25 (when a=5)
so (10a – a^2) = 16 (and this occurs when b=3)
this is true for a = 8 and a = 2
Hence valid house numbers for Y are
83 (Mr X living at 73)
23(Mr X living at 13)
Both these sets of figures work as Charlie pointed out.
Any more?
3 digit case
Mr Y living at # abc
Mr X living at # a^2 + b^2 + c^2
By inspection a=1
So,
i) Mr Y’s number is bigger
abc – (a^2 + b^2 + c^2) = 10
since a=1
100 + 10b + c – (1 + b^2 + c^2) = 10
10b + c – (b^2 + c^2) = 89
or, (10b – b^2) + (c – c^2) = 89
(10b – b^2) has a minimum value of 9 so,
(c – c^2)<98
which it can’t be
ii) Mr X’s number is bigger
(a^2 + b^2 + c^2) – abc =10
rearranging again,
(1 + b^2 + c^2) – (100 + 10b + c) =10
(b^2 + c^2) – (10b + c) =109
(b^210b) + (c^2 – c) = 109
(b^210b) is always negative hence
(c^2 – c) must be a three figure number, which clearly it can’t be.
More than three digits?
Clearly the sum of the squares of the digits can only increase by 81 per new digit introduced hence for more than three digits the possibilities of solutions are nonexistent.
Excuse this post if it's a bit messy  flooble wouldn't let me preview it.

Posted by Lee
on 20031202 12:55:20 