login
A393287
a(n) is the least k >= 1 such that n + k^2 is the digit reversal of a square.
2
36, 4, 1, 12, 2, 104, 3076737, 1, 3, 6, 301, 7, 9, 2, 26, 6, 1, 32, 12, 121, 5, 228, 11, 68, 6, 35, 5, 78, 823, 4, 82260, 83, 215, 360, 206, 4, 3, 5, 65, 9, 20, 2, 3, 10, 1, 21, 4, 2, 8235, 25, 1, 3, 98, 3, 228, 40, 2, 6, 2, 1, 30, 1, 9, 42, 32, 25, 9, 22804, 5, 111, 9521, 7, 402, 40, 110, 24, 1032685
OFFSET
1,1
COMMENTS
Trailing zeros in n + k^2 are not allowed.
a(n) = 1 iff n+1 is in A074896.
LINKS
Michel Marcus, Table of n, a(n) for n = 1..498 (terms 1..148 from Robert Israel).
EXAMPLE
a(4) = 12 because 4 + 12^2 = 148 is the digit reversal of 841 = 29^2, and no smaller k works.
MAPLE
rev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
f:= proc(n) local v, k;
for k from 1 do
v:= n+k^2;
if v mod 10 = 0 then next fi;
v:= rev(v);
if issqr(v) then return k fi;
od
end proc:
map(f, [$1..100]);
MATHEMATICA
a[n_]:=Module[{k=1}, While[Mod[n+k^2, 10]==0||!IntegerQ[Sqrt[IntegerReverse[n+k^2]]], k++]; k] (* James C. McMahon, Feb 16 2026 *)
PROG
(PARI) a(n) = my(k=1); while (!(((n+k^2)%10) && issquare(fromdigits(Vecrev(digits(n+k^2))))), k++); k; \\ Michel Marcus, Feb 09 2026
(PARI) a(n) = {my(d = [1..20]); for(i = 1, 10, if((i^2 + n) % 10 == 0, d = setminus(d, Set([i, i+10])))); d = select(x->x<=d[1]+10, d); step = vector(#d-1, i, d[i+1]-d[i]);
forstep(i = d[1], oo, step, if(issquare(fromdigits(Vecrev(digits(n+i^2)))), return(i)))} \\ David A. Corneth, Feb 17 2026
CROSSREFS
Sequence in context: A037935 A159824 A285575 * A227168 A100252 A020340
KEYWORD
nonn,base
AUTHOR
Robert Israel, Feb 09 2026
STATUS
approved