%I #18 Aug 25 2024 18:59:19
%S 1,2,1,3,2,4,3,4,5,5,6,6,7,8,9,7,10,8,11,12,13,9,14,15,16,17,18,10,19,
%T 11,20,21,22,23,24,12,25,26,27,13,28,14,29,30,31,15,32,33,34,35,36,16,
%U 37,38,39,40,41,17,42,18,43,44,45,46,47,19
%N a(n) = j if n is the j-th prime, else a(n) = k if n is the k-th composite.
%H Reinhard Zumkeller, <a href="/A026238/b026238.txt">Table of n, a(n) for n = 2..10000</a>
%F a(n) = A049084(n) + A066246(n) for n >= 2.
%t Table[If[PrimeQ[n],PrimePi[n],n-1-PrimePi[n]],{n,2,70}] (* _Harvey P. Dale_, Jun 06 2017 *)
%o (Haskell)
%o a026238 n = a049084 n + a066246 n -- _Reinhard Zumkeller_, Jan 29 2014
%o (PARI) first(n)=my(c,p); vector(n-1,k, if(isprime(k+1),p++,c++)) \\ _Charles R Greathouse IV_, Sep 02 2015
%Y Cf. A049084, A066246, A026233, A239968.
%K nonn
%O 2,2
%A _Clark Kimberling_