Define a sequence such that A 1 = 2 and A n + 1 is the sum of the squares of the digits of A n . Determine the value of A 1 9 9 9 + A 2 0 0 0 .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
You obtained that a 9 = 2 0 but then switched to a 9 = 2 . Which is correct and why?
Oh! I have made a mistake to write. Actually, a 1 0 depends on a 9 . And a 9 = 2 0 . So, a 1 0 = 2 2 + 0 2 = 2 2 = 4 . Here we can remove the 0 2 only for a 1 0 .
But for all a 8 k + 1 = 2 0 ,where k ∈ N ......
For example : a 2 0 0 1 = 2 0
I have written a 9 = 2 only for a 1 0 ...........
We compute the first few values of A n :
Notice that A 2 = A 1 0 , so the sequence repeats with a period of 8 (starting with A 2 ); we can use this fact to compute A 1 9 9 9 and A 2 0 0 0 easily. Because 1 9 9 9 ≡ 7 ( m o d 8 ) and 2 0 0 0 ≡ 0 ( m o d 8 ) , we have A 1 9 9 9 + A 2 0 0 0 = A 7 + A 8 = 1 4 5 + 4 2 = 1 8 7 .
If we started with a number other than 2 , can we arrive at other cycles? How many different cycles could there be? Is it finite, or could there be infinitely many?
CM: Claim: If you start with any number, you will reach one of a finite number of cycles.
Proof: Notice what happens if you start with a k > 3 digit number, then the maximum value of the sum of the squares of the digits of that number is 8 1 k , which will give you a number with less digits. For k = 3 , an analysis can show you that an iteration will always result in a smaller number. That said, there are clearly a finite number of integers that can be held in the sequence, thus there are a finite number of cycles and all sequences will end in a cycle.
I'll implement a program shortly to find all the possible cycles.
Log in to reply
I've written some code in Python:
cycles = []
def sum_of_squares(num):
sum = 0
for digit in str(num):
sum += int(digit)**2
return sum
def analyze(num):
current_cycle = []
while(True):
for cycle in cycles:
if num in cycle: # cycle already found
return
if num in current_cycle: # new cycle!
new_cycle = current_cycle[current_cycle.index(num):]
cycles.append(new_cycle)
break
current_cycle.append(num)
num = sum_of_squares(num)
for n in range(1,1000):
analyze(n)
print(cycles)
It turns out, the only cycles are
4 ⇒ 1 6 ⇒ 3 7 ⇒ 5 8 ⇒ 8 9 ⇒ 1 4 5 ⇒ 4 2 ⇒ 2 0 ⇒ 4
and
1 ⇒ 1 ⇒ …
Log in to reply
Nice. I'm rather new to python, so I wasn't exactly sure how to separate the digits from a number.
Log in to reply
@Bob Krueger – I'm also pretty new to Python, I sometimes spend more time in the documentation and stackoverflow than with actual coding. I'd say it's a matter of breaking each step up into elementary steps (e.g. converting from an integer to a string, or iterating through a string), which can be found online in a matter of seconds.
A1=2, A2=4, A3=16, A4=37, A5=58, A6=89, A7=145, A8=42, A9=20, A10=4 so we are getting repeated series after every 8th term we can sayAn=An+8k for n> 1 and k is integer
So A1999=A7+8×249=A7 And A2000=A8+8×249=A8
So our ans is A7+A8=145+42=187
we observe that A1=2, A2=4, A3=16, A5=59, A6=89, A7=145, A8=42, A9=20, A10=4,A11=11.... we observe that Ak=A(k+8) it has period 8. Then A1999+A2000=A7+A8=145+42=187
Write down the first few An,it is not hard to find out (2,4,16,37,58,89,145,42),(20,4,16,37,58,89,145,42)...
So A1999=145 A2000=42,
A1999+A2000=145+42=187
A1=2 A2=4 A3=16 A4=37 A5=58 A6=89 A7=145 A8=42 A9=20 A10=4=A2 THUS WE SEE THAT EVERY A(8K+2)=4 NOW A1994=4 A1995=16 A1996=37 A1997=58 A1998=89 A1999=145+(A2000=)42=187
The first couple of values of the sequence are: A 1 = 2 , A 2 = 4 , A 3 = 1 6 , A 4 = 3 7 , A 5 = 5 8 , A 6 = 8 9 , A 7 = 1 4 5 , A 8 = 4 2 , A 9 = 2 0 , A 1 0 = 4 . . . . . .
So, we see that, the sequence repeats from here onwards, having recurring groups of 8 terms with values from A 2 to A 9 .
Now, 1 9 9 9 = 8 × ( 2 4 9 ) + 7 . So, upto A 1 9 9 9 the sequence completes 2 4 9 8 -term groups and 7 additional terms. Since, A 1 doesn't repeat, A 1 9 9 9 is the 6 t h term of the group, i.e, 1 4 5 . So, the next term, i.e, A 2 0 0 0 is 4 2 .
Therefore, A 1 9 9 9 + A 2 0 0 0 = 1 4 5 + 4 2 = 1 8 7 .
Write the first few terms & observe that every 8 numbers repeat. (You may take A 1 to be 20,this doesn't alter other terms) From here find the result.
Computing A[n] for the first 10 values gives
{2, 4, 16, 37, 58, 89, 145, 42, 20, 4}.
After the initial A[1], A[n] follows a circular pattern of length 8.
A[1999] = A[1 + 1998mod8] = A[7] = 145
A[2000] = A[1 + 1999mod8] = A[8] = 42
A[1999] + A[2000] = 145 + 42 = 187
You noticed that A 1 is not part of the pattern in the sequence. What other numbers can we start with and eventually arrive at this particular cycle of 8 numbers?
To address the CM, we can start with any number whose digits sum to the one of the values in the cycle. This can include just adding 0's and starting with 2 0 0 0 or even starting with a number with 37 digits which are all 1's, leading us to a cycle 1 1 1 . . . , 3 7 , 5 8 , 8 9 , 1 4 5 , 4 2 , 2 0 , 4 , 1 6 , 3 7 , 5 8 . . .
Log in to reply
Those start values are trivial. More interestingly:
3 ⇒ 9 ⇒ 8 1 ⇒ 6 5 ⇒ 6 1 ⇒ 3 7 ,
which is part of the sequence. Also,
5 ⇒ 2 5 ⇒ 2 9 ⇒ 8 5 ⇒ 8 9
and
6 ⇒ 3 6 ⇒ 4 5 ⇒ 4 1 ⇒ 1 7 ⇒ 5 0 ⇒ 2 5 ⇒ 2 9 ⇒ 8 5 ⇒ 8 9 .
However,
7 ⇒ 4 9 ⇒ 9 7 ⇒ 1 3 0 ⇒ 1 0 ⇒ 1 ⇒ 1 ⇒ …
We begin by writing out several terms of A_{n} to identify a pattern: A 1 = 2 A 2 = 4 A 3 = 1 6 ... A 7 = 1 4 5 A 8 = 4 2 A 9 = 2 0 A 1 0 = 4
At A 1 0 , the pattern that started with A 2 starts all over again. This pattern has 8 terms. Because it starts on A 2 , to find the value of A 2 0 0 0 , we divide 2000-1 by 8, which gives us 249 with a remainder of 7. Thus, A 2 0 0 0 is the 7th term of the pattern: 42. Hence, A 1 9 9 9 = A 7 = 145. 145 + 42 = 187.
Problem Loading...
Note Loading...
Set Loading...
We know, a 1 = 2
So, a 2 = 2 2 = 4
a 3 = 4 2 = 1 6
a 4 = 1 2 + 6 2 = 3 7
a 5 = 3 2 + 7 2 = 5 8
a 6 = 5 2 + 8 2 = 8 9
a 7 = 8 2 + 9 2 = 1 4 5
a 8 = 1 2 + 4 2 + 5 2 = 4 2
a 9 = 4 2 + 2 2 = 2 0 and that means a 9 = 2 = a 1 .
So, it's clear that, a k = a k m o d 8 .
Now, a 1 9 9 9 + a 2 0 0 0 = a 7 + a 8 = 1 4 5 + 4 2 = 1 8 7