login
A256421
Odd numbers and twice primes, sorted.
2
1, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 25, 26, 27, 29, 31, 33, 34, 35, 37, 38, 39, 41, 43, 45, 46, 47, 49, 51, 53, 55, 57, 58, 59, 61, 62, 63, 65, 67, 69, 71, 73, 74, 75, 77, 79, 81, 82, 83, 85, 86, 87, 89, 91, 93, 94
OFFSET
1,2
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n) ~ 2n. - Charles R Greathouse IV, Apr 07 2015
MATHEMATICA
Select[Range@94, PrimeQ[#/2]||OddQ[#]&] (* Ivan N. Ianakiev, Apr 08 2015 *)
PROG
(PARI) lista(nn) = nb = primepi(nn)\2; vecsort(setunion(vector(prime(nb), n, 2*n-1), 2*primes(nb))); \\ Michel Marcus, Apr 07 2015
(PARI) list(lim)=setunion(vector((lim+1)\2, i, 2*i-1), 2*primes([2, lim])) \\ Charles R Greathouse IV, Apr 07 2015
(Python)
from sympy import primepi
def A256421(n):
def f(x): return int(n+(m:=x>>1)-primepi(m))
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m # Chai Wah Wu, Oct 15 2024
CROSSREFS
Cf. A256420.
Sequence in context: A039133 A113777 A285659 * A253200 A227938 A039096
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Apr 07 2015
STATUS
approved