A065207 Numbers which need two 'Reverse and Add' steps to reach a palindrome.
19, 28, 37, 39, 46, 48, 49, 57, 58, 64, 67, 73, 75, 76, 82, 84, 85, 91, 93, 94, 109, 119, 129, 139, 149, 150, 152, 153, 154, 159, 160, 162, 163, 169, 170, 172, 173, 179, 189, 208, 218, 219, 228, 229, 238, 239, 248, 250, 251, 253, 258, 259, 260, 261, 268, 269
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Harry J. Smith)
- Index entries for sequences related to Reverse and Add!
Programs
-
ARIBAS
revadd_steps(2,58); (* For the definition of function revadd_steps see A065206. *)
-
Mathematica
trasQ[n_]:=Length[NestWhileList[IntegerReverse[#]+#&,n,!PalindromeQ[ #]&,1,5]] ==3; Select[Range[300],trasQ] (* Harvey P. Dale, Apr 13 2022 *)
-
PARI
isok(n,s=2)={for(k=0, s, my(r=fromdigits(Vecrev(digits(n)))); if(r==n, return(k==s)); n += r); 0} \\ Andrew Howroyd, Dec 06 2024
-
Python
def ra(n): s = str(n); return int(s) + int(s[::-1]) def ispal(n): s = str(n); return s == s[::-1] def aupto(limit): alst = [] for k in range(limit+1): if ispal(k): continue k2 = ra(k) if ispal(k2): continue if ispal(ra(k2)): alst.append(k) return alst print(aupto(269)) # Michael S. Branicky, May 06 2021
Extensions
Offset changed from 0 to 1 by Harry J. Smith, Oct 14 2009
Comments