OFFSET
1,3
EXAMPLE
a(11) = 111 because 111 cannot be produced by performing reverse-and-add operations on any number prior to 111 that is not already a palindrome.
MAPLE
reverse := proc (d) local n, m; m := 0; n := d; while n>0 do m := m*10+(n mod 10); n := (n-(n mod 10))/10; od; m; end; isPalindromic := proc (n) if (n=reverse(n)) then true; else false; fi; end; revAddPal := proc (n) local m, i; i := 0; m := n; while not(isPalindromic(m)) and (i<10^2) do i := i+1; m := m+reverse(m); od; isPalindromic(m), m, i; end; revAddPalSeq2 := proc(numTerms) local i, sPals, allPals, r; sPals := {}; allPals := {}; for i from 0 to numTerms do if not(isPalindromic(i)) then r := [revAddPal(i)]; if r[1] then sPals := sPals union {r[2]}; fi; else allPals := allPals union {i}; fi; od; allPals minus sPals; end; revAddPalSeq2(1000);
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Chuck Seggelin (barkeep(AT)plastereddragon.com), Oct 28 2003
STATUS
approved