login
a(n) = Sum_{i=0..n-1} 2^i*prime(n-i).
5

%I #33 Feb 17 2024 12:47:44

%S 2,7,19,45,101,215,447,913,1849,3727,7485,15007,30055,60153,120353,

%T 240759,481577,963215,1926497,3853065,7706203,15412485,30825053,

%U 61650195,123300487,246601075,493202253,986404613,1972809335,3945618783,7891237693,15782475517

%N a(n) = Sum_{i=0..n-1} 2^i*prime(n-i).

%D Eric Angelini, "Array with primes." Pers. comm. on the SeqFan mailing list, Sep. 7 2005.

%H Alois P. Heinz, <a href="/A110299/b110299.txt">Table of n, a(n) for n = 1..1000</a>

%F G.f: b(x)/(1-2*x), where b(x) is the g.f. of A000040. - _Mario C. Enriquez_, Dec 10 2016

%F a(n) = 2*a(n-1) + A000040(n) for n>0 with a(0)=0. - _Alois P. Heinz_, Dec 10 2016

%F From _Ridouane Oudra_, Jan 25 2024: (Start)

%F a(n) = Sum_{i=0..prime(n+1)-1} (2^(n-pi(i)) - 1), where prime(n) = A000040(n) and pi(n) = A000720(n).

%F a(n) = A125180(n+1) - A000040(n+1);

%F a(n) = Sum_{i=1..n} A125180(i);

%F a(n) = A007504(n) + Sum_{i=1..n-1} a(i). (End)

%p a:= proc(n) option remember;

%p `if`(n=0, 0, ithprime(n)+2*a(n-1))

%p end:

%p seq(a(n), n=1..30); # _Alois P. Heinz_, Dec 10 2016

%t Table[Sum[2^i * Prime[n-i], {i, 0, n-1}], {n, 1, 30}]

%o (PARI) a(n) = fromdigits(primes(n),2); \\ _Kevin Ryde_, Jun 22 2022

%o (Magma)

%o A110299:= func< n | (&+[2^(n-j)*NthPrime(j): j in [1..n]]) >;

%o [A110299(n): n in [1..40]]; // _G. C. Greubel_, Jan 03 2023

%o (SageMath)

%o @CachedFunction # a = A110299

%o def a(n): return 2 if (n==1) else 2*a(n-1) + nth_prime(n)

%o [a(n) for n in range(1,41)] # _G. C. Greubel_, Jan 03 2023

%o (Python)

%o from sympy import prime

%o def A110299(n):

%o c = 0

%o for i in range(n):

%o c = (c<<1)+prime(i+1)

%o return c # _Chai Wah Wu_, Jan 04 2023

%Y Cf. A000040, A135483, A287353.

%Y Cf. A125180, A000720, A007504

%K nonn,easy

%O 1,1

%A _Ryan Propper_, Sep 07 2005