A381368 a(n) is the least k > n for which prime(n) + prime(k) is a square.
4, 6, 5, 10, 16, 9, 8, 102, 13, 20, 30, 28, 17, 26, 16, 58, 33, 23, 55, 21, 54, 142, 30, 28, 49, 48, 139, 35, 91, 47, 45, 44, 56, 135, 54, 40, 39, 252, 51, 49, 78, 128, 62, 76, 75, 126, 245, 71, 55, 69, 54, 68, 120, 137, 81, 65, 63, 238, 171, 96, 62, 76, 108, 209
Offset: 1
Examples
a(2) = 6 because prime(2) + prime(6) = 3 + 13 = 4^2 and 3 + 5, 3 + 7, 3 + 11 are not squares.
Links
- Felix Huber, Table of n, a(n) for n = 1..10000
Programs
-
Maple
A381368:=proc(n) local k; for k from n+1 do if issqr(ithprime(n)+ithprime(k)) then return k fi od end proc; seq(A381368(n),n=1..64);
-
Mathematica
a[n_]:=Module[{k=n+1},While[!IntegerQ[Sqrt[Prime[n]+Prime[k]]], k++]; k]; Array[a,64] (* Stefano Spezia, Mar 02 2025 *)
-
PARI
a(n) = my(k=n+1, q=prime(n+1), p=prime(n)); while (!issquare(p+q), k++;q=nextprime(q+1)); k; \\ Michel Marcus, Mar 02 2025
Comments