OFFSET
1,3
COMMENTS
Although the sequence is infinite, in a sense it cycles. The outside of the next palindrome beginning with 20 continues 31, 40, 51, 60, 71, 80, 91 and back to 20. The inside oscillates between increasing number of zeros and ones.
MATHEMATICA
NextPalindrome[n_] := Block[{l = Floor[Log[10, n] + 1], idn = IntegerDigits[n]}, If[ Union[idn] == {9}, Return[n + 2], If[l < 2, Return[n + 1], If[ FromDigits[ Reverse[ Take[idn, Ceiling[l/2]]]] FromDigits[ Take[idn, -Ceiling[l/2]]], FromDigits[ Join[ Take[idn, Ceiling[l/2]], Reverse[ Take[idn, Floor[l/2]]]]], idfhn = FromDigits[ Take[idn, Ceiling[l/2]]] + 1; idp = FromDigits[ Join[ IntegerDigits[idfhn], Drop[ Reverse[ IntegerDigits[idfhn]], Mod[l, 2]]]]]]]]; a[0] = 0; a[n_] := a[n] = Block[{k = a[n - 1], d = IntegerDigits[a[n - 1]]}, While[ Intersection[d, IntegerDigits[k]] != {}, k = NextPalindrome[k]]; k]; Table[ a[n], {n, 0, 50}]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Edited by Robert G. Wilson v, Jun 27 2003
STATUS
approved