OFFSET
0,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (111,-1110,1000).
FORMULA
From Chai Wah Wu, Jun 13 2024: (Start)
a(n) = 111*a(n-1) - 1110*a(n-2) + 1000*a(n-3) for n > 4.
G.f.: (-8000*x^4 + 690*x^3 - 808*x^2 + 100*x - 1)/((x - 1)*(10*x - 1)*(100*x - 1)). (End)
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]]]] ]]]]; p = NestList[ NextPalindrome, 1, 10^5]; Table[ p[[10^n]], {n, 0, 5}]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Jun 17 2003
EXTENSIONS
More terms from Ray Chandler, Jul 23 2003
STATUS
approved