login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A117668 a(n) is the n-th prime number if n is prime; a(n) is the n-th nonprime number otherwise. 0

%I #11 Oct 01 2021 17:13:28

%S 1,3,5,8,11,10,17,14,15,16,31,20,41,22,24,25,59,27,67,30,32,33,83,35,

%T 36,38,39,40,109,44,127,46,48,49,50,51,157,54,55,56,179,58,191,62,63,

%U 64,211,66,68,69,70,72,241,75,76,77,78,80,277,82,283,85,86,87,88,90,331,92,93,94,353,96,367,99,100

%N a(n) is the n-th prime number if n is prime; a(n) is the n-th nonprime number otherwise.

%e a(1) is the first nonprime: 1.

%e a(2) is the second prime: 3.

%t Module[{nn=100,np,pr,len},np=Select[Range[nn],!PrimeQ[#]&];len = Length[ np];pr=Prime[Range[len]];Table[If[PrimeQ[n],pr[[n]],np[[n]]],{n,len}]] (* _Harvey P. Dale_, Oct 01 2021 *)

%Y Cf. A000040, A002808.

%K nonn

%O 1,2

%A Luc Stevens (lms022(AT)yahoo.com), Apr 11 2006

%E Definition corrected by _Michel Marcus_, Jun 01 2013

%E Corrected and extended by _Harvey P. Dale_, Oct 01 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 1 00:07 EDT 2024. Contains 372143 sequences. (Running on oeis4.)