Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #19 Nov 06 2024 04:11:46
%S 2,6,8,7,10,13,14,19,23,29,20,37,22,43,47,53,27,61,30,71,73,79,35,89,
%T 97,101,103,107,44,113,46,131,137,139,149,151,54,163,167,173,58,181,
%U 62,193,197,199,66,223,227,229,233,239,75,251,257,263,269,271,82
%N The n-th term is the n-th composite if n is prime, and the n-th prime if n is not prime.
%C See A097457 for the (maybe more natural) variant where "n-th composite"(=A002808(n)) is replaced by "n-th nonprime" (=A018252(n)).
%C Essentially the same as A088608. - _R. J. Mathar_, Feb 03 2014
%H Harvey P. Dale, <a href="/A236676/b236676.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) = A002808(n) if n is prime, a(n) = A000040(n) else.
%t Module[{nn=100,prs,cmps,len},cmps=Select[Range[nn],CompositeQ];len= Length[ cmps];prs=Prime[Range[len]];Table[If[PrimeQ[n],cmps[[n]],prs[[n]]],{n,len}]] (* _Harvey P. Dale_, Dec 27 2022 *)
%o (PARI) A236676 = n->if(isprime(n),A002808(n),prime(n))
%Y Cf. A026234, A236675.
%K nonn
%O 1,1
%A _M. F. Hasler_, Jan 29 2014