OFFSET
1,1
COMMENTS
All primes but 2 and 3 are present in A007310, making this sequence an efficient method for storing large quantities of primes. To unpack this sequence into primes, use the formula (6n + (-1)^n - 3) / 2.
Indices 1 and 9 (1 and 25) are the smallest nonprimes.
LINKS
Grant Garcia, Table of n, a(n) for n=1..10000
FORMULA
a(n) = floor(prime(n+2)/3)+1 = A144769(n+2)+1. - Gary Detlefs, Dec 11 2011
a(n) ~ n*log(n)/3. - Ilya Gutkovskiy, Jul 18 2016
EXAMPLE
MATHEMATICA
Floor[Prime[Range[3, 80]]/3]+1 (* Harvey P. Dale, Sep 12 2019 *)
PROG
(Python)
from sympy import isprime
out = ""
for n, p in enumerate(isprime((6*n+(-1)**n-3)//2) for n in range(1, 1000)):
out+=["", "%s "%str(n+1)][p]
for n, p in enumerate(out.rstrip(" ").split(" ")): print(n+1, p)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Grant Garcia, Nov 07 2010
STATUS
approved