A very long number

From the 2000 University of Waterloo Cayley Contest:

The leftmost digit of an integer of length 2000 digits is 3. In this integer, any two consecutive digits must be divisible by 17 or 23. The 2000th digit may be either ‘a’ or ‘b’. What is the value of a+b?

Solution

Advertisements