A289868 Consider the digit reverse of a number x. Take the sum of these digits and repeat the process deleting the first addend and adding the previous sum. The sequence lists the numbers that after some iterations reach a sum equal to x.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 21, 25, 42, 63, 84, 143, 286, 2355, 5821, 6618, 11709, 12482, 33747, 39571, 129109, 466957, 1162248, 1565166, 1968084, 3636638, 3853951, 4898376, 13443745, 13933175, 17118698, 22421197, 24153462, 147440984, 209989875, 245742153
Offset: 0
Examples
Digit reverse of 17 is 71 and 7 + 1 = 8, 1 + 8 = 9, 8 + 9 = 17; Digit reverse of 286 is 682 and 6 + 8 + 2 = 16, 8 + 2 + 16 = 26, 2 + 16 + 26 = 44, 16 + 26 + 44 = 86, 26 + 44 + 86 = 156, 44 + 86 + 156 = 286.
Programs
-
Maple
P:=proc(q) local a,b,k,n; for n from 0 to q do a:=convert(n,base,10); b:=convert(a,`+`); while b
-
Mathematica
Select[Range[10^6], Function[n, Total@ NestWhile[Append[Drop[#, 1], Total@ #] &, Reverse@ IntegerDigits@ n, Total@ # < n &] == n]] (* Michael De Vlieger, Jul 20 2017 *)
-
PARI
is(n) = {my(d = Vecrev(digits(n))); while(vecsum(d)
David A. Corneth, Jul 20 2017
Comments