+0

0
197
1

Jeremy is writing down a sequence of integers. He writes 1 as his first number. Then, he squares it and adds 3, writing down 4 next. He squares 4 and adds 3, writing down 19 as his third number. If Jeremy continues his square-and-add pattern, what will the units digit of the 20th number in his list be?

Jun 1, 2020

#1
0

a=1;p=0;b=a^2+3;printb;c=b;cycle:c=c^2+3;printc;p++;if(p<=18, goto cycle,0)
These are the 20 terms of your sequence. Notice that the last and 20th term is 335,690 digits long! The last 10 digits of that number are =1,569,412,499

4
19
364
132499
1 7555985004
3 0821260946 0672880019
9.499501263 E+40
9.024052425 E+81
8.143352216 E+163
6.631418532 E+327
4.397571175 E+655
1.933863224 E+1311
3.739826967 E+2622
1.398630575 E+5245
1.956167484 E+10490
3.826591226 E+20980
1.464280041 E+41961
2.144116039 E+83922
4.597233587 E+167844
2.113455665 E+335689

Note: There appears to be pattern of alternating between 4 for odd numbers and 9 for even numbers.

Jun 1, 2020
edited by Guest  Jun 1, 2020