OFFSET
1,1
COMMENTS
Subsequence of A163497.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 1000 terms from Donovan Johnson)
EXAMPLE
2 is a term since 2 has adjacent numbers 1 (cube) and 3 (prime).
28 is a term since 28 has adjacent numbers 27 (cube) and 29 (prime).
728 is a term since 728 has adjacent numbers 727 (prime) and 729 (cube).
MATHEMATICA
Select[Which[PrimeQ[ #+2], #+1, PrimeQ[ #-2], #-1, True, 0]&/@(Range[1000]^3), #!=0&] (* Harvey P. Dale, Sep 29 2009 *)
PROG
(Python)
from sympy import isprime
def aupto(limit):
i, c, alst = 1, 1, []
while c <= limit + 1:
if isprime(c-2) and c-1 <= limit: alst.append(c-1)
if isprime(c+2) and c+1 <= limit: alst.append(c+1)
i += 1
c = i**3
return alst
print(aupto(5000212)) # Michael S. Branicky, Feb 28 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Gaurav Kumar, Aug 28 2009
EXTENSIONS
Edited by Zak Seidov, Aug 30 2009
a(20)-a(30) from Donovan Johnson, Sep 16 2009
STATUS
approved