A261424 Difference between n and the largest palindrome <= n.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Offset: 0
Links
- N. J. A. Sloane, Table of n, a(n) for n = 0..20000
Programs
-
Maple
# P has list of palindromes palfloor:=proc(n) global P; local i; for i from 1 to nops(P) do if P[i]=n then return(n); fi; if P[i]>n then return(P[i-1]); fi; od: end; [seq(n-palfloor(n),n=0..200)];
-
Mathematica
palQ[n_] := Block[{d = IntegerDigits@ n}, d == Reverse@ d]; Table[k = n; While[Nand[palQ@ k, k > -1], k--]; n - k, {n, 0, 86}] (* Michael De Vlieger, Sep 09 2015 *)
Formula
a(n) = n - A261423(n). - M. F. Hasler, Sep 11 2015
Comments