login
A289829
Perfect squares of the form prime(k+1)^2 - prime(k)^2 + 1 where prime(k) is the k-th prime number.
1
25, 49, 121, 169, 289, 361, 841, 961, 1681, 1849, 2401, 2809, 3721, 5929, 6889, 7921, 8281, 10201, 11449, 11881, 14161, 14641, 17689, 24649, 26569, 32041, 38809, 41209, 43681, 44521, 61009, 63001, 69169, 76729, 80089, 85849, 89401, 94249, 96721, 97969, 108241
OFFSET
1,1
EXAMPLE
7^2 - 5^2 + 1 = 5^2, 17^2 - 13^2 + 1 = 11^2, 47^2 - 43^2 + 1 = 19^2, etc.
MATHEMATICA
TakeWhile[#, # < 110000 &] &@ Union@ Select[Array[Prime[# + 1]^2 - Prime[#]^2 + 1 &, 10^4], IntegerQ@ Sqrt@ # &] (* Michael De Vlieger, Jul 13 2017 *)
PROG
(Python)
from __future__ import division
from sympy import divisors, isprime, prevprime, nextprime
A289829_list = []
for n in range(10**4):
m = n**2-1
for d in divisors(m):
if d*d >= m:
break
r = m//d
if not r % 2:
r = r//2
if not isprime(r):
p, q = prevprime(r), nextprime(r)
if m == (q-p)*(q+p):
A289829_list.append(n**2)
break # Chai Wah Wu, Jul 15 2017
(PARI) is(n) = if(!issquare(n), return(0), my(p=2); while(1, if(n==nextprime(p+1)^2-p^2+1, return(1)); p=nextprime(p+1); if(p > n, return(0)))) \\ Felix Fröhlich, Jul 15 2017
CROSSREFS
Sequence in context: A106564 A308177 A104777 * A358060 A131706 A110015
KEYWORD
nonn
AUTHOR
Joseph Wheat, Jul 12 2017
EXTENSIONS
More terms from Alois P. Heinz, Jul 13 2017
STATUS
approved