login
Base-10 palindromes that cannot be formed by performing reverse-and-add operations on any previous nonpalindromic positive integers.
0

%I #7 Dec 02 2015 03:56:01

%S 0,1,2,3,4,5,6,7,8,9,111,131,151,171,191,212,232,252,272,292,313,333,

%T 353,373,393,414,434,454,474,494,515,535,555,575,595,616,636,656,676,

%U 696,717,737,757,777,797,818,838,858,878,898,919,939,959,979,999

%N Base-10 palindromes that cannot be formed by performing reverse-and-add operations on any previous nonpalindromic positive integers.

%e 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.

%p 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);

%K base,nonn

%O 1,3

%A Chuck Seggelin (barkeep(AT)plastereddragon.com), Oct 28 2003