login
a(2n-1) = 2*(p-1) and a(2n) = p + 3, where p=prime(n).
2

%I #17 Sep 08 2022 08:45:23

%S 2,5,4,6,8,8,12,10,20,14,24,16,32,20,36,22,44,26,56,32,60,34,72,40,80,

%T 44,84,46,92,50,104,56,116,62,120,64,132,70,140,74,144,76,156,82,164,

%U 86,176,92,192,100,200,104,204,106,212,110,216,112,224,116,252,130,260,134

%N a(2n-1) = 2*(p-1) and a(2n) = p + 3, where p=prime(n).

%H G. C. Greubel, <a href="/A114557/b114557.txt">Table of n, a(n) for n = 1..10000</a>

%F a(2n-1) = A037168(n). a(2n) = A113935(n).

%F a(n) = ( (3 - (-1)^n)*prime(floor((n+1)/2)) + (1 + 5*(-1)^n) )/2. - _G. C. Greubel_, May 20 2019

%t Flatten[Table[Abs[Coefficient[Expand[(x+2)(x -(1 +Sqrt[Prime[n]]))*(x - (1 - Sqrt[Prime[n]]))], x, m]], {n, 1, 50}, {m, 0, 1}]]

%t With[{p = Prime[Floor[(n+1)/2]]}, Table[If[OddQ[n], 2*(p-1), p+3], {n, 1, 70}]] (* _G. C. Greubel_, May 20 2019 *)

%o (PARI) {a(n) = ((3-(-1)^n)*prime(floor((n+1)/2)) + (1+5*(-1)^n))/2}; \\ _G. C. Greubel_, May 20 2019

%o (Magma) [((3-(-1)^n)*NthPrime(Floor((n+1)/2)) + (1+5*(-1)^n))/2: n in [1..70]]; // _G. C. Greubel_, May 20 2019

%o (Sage) [( (3-(-1)^n)*nth_prime(floor((n+1)/2))+ (1+5*(-1)^n))/2 for n in (1..70)] # _G. C. Greubel_, May 20 2019

%K nonn,easy

%O 1,1

%A _Roger L. Bagula_, Feb 15 2006