login

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”).

a(n) = prime(n) if n prime otherwise 1.
0

%I #8 Sep 08 2022 08:46:13

%S 1,3,5,1,11,1,17,1,1,1,31,1,41,1,1,1,59,1,67,1,1,1,83,1,1,1,1,1,109,1,

%T 127,1,1,1,1,1,157,1,1,1,179,1,191,1,1,1,211,1,1,1,1,1,241,1,1,1,1,1,

%U 277,1,283,1,1,1,1,1,331,1,1,1,353,1,367,1,1,1,1

%N a(n) = prime(n) if n prime otherwise 1.

%C The subsequence of prime terms is A006450.

%e a(7) = 17 because prime(7) = 17 is prime.

%e a(8) = 1 because 8 is not prime.

%t Table[If[! PrimeQ[n], 1, Prime[n]], {n, 100}]

%o (Magma) [IsPrime(n) select NthPrime(n) else 1: n in [1..100]];

%Y Cf. A006450, A007821, A010051, A061397, A191558, A259175.

%K nonn,easy

%O 1,2

%A _Vincenzo Librandi_, Jun 20 2015