[go: up one dir, main page]

login
a(n) = n-th prime * n-th nonprime.
3

%I #12 Dec 28 2018 02:50:17

%S 2,12,30,56,99,130,204,266,345,464,558,740,861,946,1128,1325,1534,

%T 1647,1876,2130,2336,2607,2822,3115,3492,3838,4017,4280,4578,4972,

%U 5715,6026,6576,6811,7450,7701,8164,8802,9185,9688,10203,10498,11460,11966,12411

%N a(n) = n-th prime * n-th nonprime.

%H Harvey P. Dale, <a href="/A127118/b127118.txt">Table of n, a(n) for n = 1..1000</a>

%F a(n) = A000040(n) * A018252(n).

%t Module[{nn=100,prs,non,len},prs=Prime[Range[nn]];non=Complement[ Range[ nn],prs]; len=Min[Length[prs],Length[non]]; Times@@#&/@ Thread[ {Take[ prs,len],Take[non,len]}]] (* _Harvey P. Dale_, Dec 29 2012 *)

%o (Haskell)

%o a127118 n = a000040 n * a018252 n -- _Reinhard Zumkeller_, Apr 30 2014

%o (Python)

%o from sympy import prime, composite

%o def A127118(n):

%o return 2 if n == 1 else prime(n)*composite(n-1) # _Chai Wah Wu_, Dec 27 2018

%Y Cf. A000040, A018252, A002808.

%Y Cf. A014237, A064799, A067563.

%K nonn,easy

%O 1,1

%A Neven Juric (neven.juric(AT)apis-it.hr), Mar 21 2007