login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A309932 Distance from n to closest palindrome that is different from n. 1
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 11, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 11, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 11, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 11, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 11, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 11, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 11, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 2, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,12
LINKS
MATHEMATICA
a[n_] := Module[{k = 1}, While[! PalindromeQ[n + k] && ! PalindromeQ[n - k], k++]; k]; Table[a[n], {n, 0, 100}]
PROG
(PARI) a(n)={my(ispal=v->v==Vecrev(v)); for(k=1, oo, if(ispal(digits(n+k)) || ispal(digits(n-k)), return(k)))} \\ Andrew Howroyd, Aug 23 2019
CROSSREFS
Sequence in context: A125932 A175793 A244789 * A363968 A058886 A236858
KEYWORD
nonn,base,look
AUTHOR
Ilya Gutkovskiy, Aug 23 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 6 06:55 EDT 2024. Contains 372290 sequences. (Running on oeis4.)