A260726 a(n) = smallest palindrome k > n such that k/n is a square; a(n) = 0 if no solution exists.
4, 8, 363, 484, 5445, 46464, 252, 2138312, 12321, 0, 44, 23232, 31213, 686, 53187678135, 44944, 272, 24642, 171, 0, 525, 88, 575, 46464, 5221225, 62426, 36963, 252, 464, 0, 1783799973871, 291080192, 2112, 4114, 53235, 69696, 333, 20102, 93639, 0, 656, 858858
Offset: 1
Examples
a(3) = 363, because 363/3 = 11^2. 363 * 3 = 1089, which is also a square. a(15) = 53187678135, because 53187678135/15 = 59547^2 and 53187678135 * 15 = 893205^2.
Links
- Giovanni Resta, Known values up to a(200)
Programs
-
Maple
ispali:= proc(n) local L; L:= convert(n,base,10); ListTools:-Reverse(L)=L end proc: f:= proc(n) local m; if n mod 10 = 0 then return 0 fi; for m from 2 to 10^6 do if ispali(m^2*n) then return m^2*n fi od: -1 # signals time-out end proc: seq(f(n), n=1..50); # Robert Israel, Aug 21 2015
-
Mathematica
palQ[n_] := Block[{d = IntegerDigits@ n}, d == Reverse@ d]; a[n_] := If[ Mod[n, 10] == 0, 0, Block[{q = 2}, While[! palQ[q^2 * n], q++]; q^2 * n]]; Array[a, 42] (* Giovanni Resta, Aug 18 2015 *)
-
Python
def a(n): if n % 10 == 0: return 0 for c in range(2, 10**8): k = str(n * c**2) if k == k[::-1]: return int(k) return -1 print(*[a(n) for n in range(1, 43)], sep=', ') # Corrected by David Radcliffe, May 10 2025
Extensions
Missing a(13) from Giovanni Resta, Aug 05 2015
Comments