OFFSET
1,3
COMMENTS
Indices of the palindromes in A005918.
LINKS
Erich Friedman, What's Special About This Number? (See entries 1737, 8340.)
EXAMPLE
567 is in the sequence because 566^2 + 567^2 + 568^2 = 964469 is a palindrome.
MATHEMATICA
palindromeQ[n_] := (id = IntegerDigits[n]) === Reverse[id]; Reap[For[n = 0, n < 10^9, n++, If[palindromeQ[(n-1)^2 + n^2 + (n+1)^2], Print[n]; Sow[n]]]][[2, 1]] (* Jean-François Alcover, Dec 03 2013 *)
Select[Range[0, 10^6], PalindromeQ[(#-1)^2+#^2+(#+1)^2]&] (* The program generates the first 16 terms of the sequence. To generate more, increase the Range constant. *) (* Harvey P. Dale, Feb 15 2022 *)
PROG
(PARI) isok(n) = v = Vec(Str((n-1)^2 + n^2 + (n+1)^2)); v == Vecrev(v); \\ Michel Marcus, Dec 03 2013
(Python)
a = 0
while a < 10000000000:
....q = (a-1)**2 + a**2 + (a+1)**2
....if str(q) == str(q)[::-1]:
........print(a, q)
....a+=1
# David Consiglio, Jr., Sep 12 2014
(Magma) [n: n in [0..2*10^7] | Intseq(3*n^2+2, 10) eq Reverse(Intseq(3*n^2+2, 10))]; // Vincenzo Librandi, Jul 17 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bruno Berselli, Dec 03 2013
EXTENSIONS
a(24)-a(25) from Jean-François Alcover, Dec 03 2013
a(26)-a(27) from David Consiglio, Jr., Sep 12 2014
a(28)-a(31) from Lars Blomberg, Jan 04 2016
STATUS
approved