A383898 a(n) is the smallest nonnegative integer k such that n + k and n*k are squares, or -1 if there is no such number.
0, 2, -1, 0, 20, -1, -1, 8, 0, 90, -1, -1, 4212, -1, -1, 0, 272, 18, -1, 5, -1, -1, -1, -1, 0, 650, -1, -1, 142100, -1, -1, 32, -1, -1, -1, 0, 1332, -1, -1, 360, 41984, -1, -1, -1, 180, -1, -1, -1, 0, 50, -1, 117, 1755572, -1, -1, -1, -1, 568458, -1, -1, 53872730964
Offset: 1
Keywords
Examples
If n = 5, then 20 satisfies that 5 + 20 = 5^2 and 5*20 = 10^2, where 20 is the smallest integer greater than 5 with this property. So, a(5) = 20.
Links
- Michel Marcus, Table of n, a(n) for n = 1..180
Programs
-
PARI
isok(m) = if (issquare(4*m), 1, #qfbsolve(Qfb(1, 0, -m), m, 2)); \\ A245226 a(n) = if (!isok(n), return(-1)); my(k=0); while (!(issquare(n+k) && issquare(n*k)), k++); k; \\ Michel Marcus, May 21 2025
-
PARI
isok(m) = if (issquare(4*m), 1, #qfbsolve(Qfb(1, 0, -m), m, 2)); \\ A245226 a(n) = if (!isok(n), return(-1)); my(x = sqrtint(n)); while (! issquare(n*(x^2 - n)), x++); x^2-n; \\ Michel Marcus, May 24 2025
Comments