login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A289829 Perfect squares of the form prime(k+1)^2 - prime(k)^2 + 1 where prime(k) is the k-th prime number. 1

%I #28 Dec 16 2019 11:40:06

%S 25,49,121,169,289,361,841,961,1681,1849,2401,2809,3721,5929,6889,

%T 7921,8281,10201,11449,11881,14161,14641,17689,24649,26569,32041,

%U 38809,41209,43681,44521,61009,63001,69169,76729,80089,85849,89401,94249,96721,97969,108241

%N Perfect squares of the form prime(k+1)^2 - prime(k)^2 + 1 where prime(k) is the k-th prime number.

%H Chai Wah Wu, <a href="/A289829/b289829.txt">Table of n, a(n) for n = 1..10000</a>

%e 7^2 - 5^2 + 1 = 5^2, 17^2 - 13^2 + 1 = 11^2, 47^2 - 43^2 + 1 = 19^2, etc.

%t TakeWhile[#, # < 110000 &] &@ Union@ Select[Array[Prime[# + 1]^2 - Prime[#]^2 + 1 &, 10^4], IntegerQ@ Sqrt@ # &] (* _Michael De Vlieger_, Jul 13 2017 *)

%o (Python)

%o from __future__ import division

%o from sympy import divisors, isprime, prevprime, nextprime

%o A289829_list = []

%o for n in range(10**4):

%o m = n**2-1

%o for d in divisors(m):

%o if d*d >= m:

%o break

%o r = m//d

%o if not r % 2:

%o r = r//2

%o if not isprime(r):

%o p, q = prevprime(r), nextprime(r)

%o if m == (q-p)*(q+p):

%o A289829_list.append(n**2)

%o break # _Chai Wah Wu_, Jul 15 2017

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

%K nonn

%O 1,1

%A _Joseph Wheat_, Jul 12 2017

%E More terms from _Alois P. Heinz_, Jul 13 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 18:05 EDT 2024. Contains 371798 sequences. (Running on oeis4.)