[go: up one dir, main page]

login
A090785
Numbers that can be expressed as the difference of the squares of consecutive primes in just one way.
5
5, 16, 24, 48, 240, 288, 360, 432, 648, 672, 720, 840, 888, 960, 1080, 1128, 1248, 1320, 1392, 1488, 1560, 1608, 1680, 1728, 1800, 1920, 2040, 2088, 2112, 2232, 2280, 2400, 2520, 2568, 2640, 2808, 2832, 2880, 3120, 3240, 3312, 3360, 3432, 3672, 3912, 4080
OFFSET
1,1
EXAMPLE
5 = 3^2 - 2^2.
PROG
(Python)
from sympy import primerange
from collections import Counter
def aupto(limit):
sqps = [p*p for p in primerange(1, limit//2+1)]
ways = Counter(sqps[i+1]-sqps[i] for i in range(len(sqps)-1))
return sorted(k for k in ways if k <= limit and ways[k] == 1)
print(aupto(4080)) # Michael S. Branicky, May 16 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Ray G. Opao, Feb 08 2004
EXTENSIONS
More terms from Ray Chandler, Feb 11 2004
STATUS
approved