Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #15 Oct 15 2024 15:43:10
%S 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,
%T 37,38,39,41,43,45,46,47,49,51,53,55,57,58,59,61,62,63,65,67,69,71,73,
%U 74,75,77,79,81,82,83,85,86,87,89,91,93,94
%N Odd numbers and twice primes, sorted.
%H Charles R Greathouse IV, <a href="/A256421/b256421.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) ~ 2n. - _Charles R Greathouse IV_, Apr 07 2015
%t Select[Range@94,PrimeQ[#/2]||OddQ[#]&] (* _Ivan N. Ianakiev_, Apr 08 2015 *)
%o (PARI) lista(nn) = nb = primepi(nn)\2; vecsort(setunion(vector(prime(nb), n, 2*n-1), 2*primes(nb))); \\ _Michel Marcus_, Apr 07 2015
%o (PARI) list(lim)=setunion(vector((lim+1)\2,i,2*i-1), 2*primes([2,lim])) \\ _Charles R Greathouse IV_, Apr 07 2015
%o (Python)
%o from sympy import primepi
%o def A256421(n):
%o def f(x): return int(n+(m:=x>>1)-primepi(m))
%o m, k = n, f(n)
%o while m != k: m, k = k, f(k)
%o return m # _Chai Wah Wu_, Oct 15 2024
%Y Cf. A256420.
%K nonn
%O 1,2
%A _N. J. A. Sloane_, Apr 07 2015