login
a(n) is the least k >= 1 such that n + k^2 is the digit reversal of a square.
2

%I #35 Feb 17 2026 15:19:12

%S 36,4,1,12,2,104,3076737,1,3,6,301,7,9,2,26,6,1,32,12,121,5,228,11,68,

%T 6,35,5,78,823,4,82260,83,215,360,206,4,3,5,65,9,20,2,3,10,1,21,4,2,

%U 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

%N a(n) is the least k >= 1 such that n + k^2 is the digit reversal of a square.

%C Trailing zeros in n + k^2 are not allowed.

%C a(n) = 1 iff n+1 is in A074896.

%H Michel Marcus, <a href="/A393287/b393287.txt">Table of n, a(n) for n = 1..498</a> (terms 1..148 from Robert Israel).

%e a(4) = 12 because 4 + 12^2 = 148 is the digit reversal of 841 = 29^2, and no smaller k works.

%p rev:= proc(n) local L,i;

%p L:= convert(n,base,10);

%p add(L[-i]*10^(i-1),i=1..nops(L))

%p end proc:

%p f:= proc(n) local v,k;

%p for k from 1 do

%p v:= n+k^2;

%p if v mod 10 = 0 then next fi;

%p v:= rev(v);

%p if issqr(v) then return k fi;

%p od

%p end proc:

%p map(f, [$1..100]);

%t 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 *)

%o (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

%o (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]);

%o forstep(i = d[1], oo, step, if(issquare(fromdigits(Vecrev(digits(n+i^2)))), return(i)))} \\ _David A. Corneth_, Feb 17 2026

%Y Cf. A074896, A392264.

%K nonn,base

%O 1,1

%A _Robert Israel_, Feb 09 2026