%I #27 Jan 16 2024 15:41:41
%S 2,5,12,26,56,114,232,466,936,1878,3758,7522,15048,30098,60200,120406,
%T 240818,481638,963282,1926568,3853138,7706282,15412568,30825142,
%U 61650292,123300588,246601178,493202360,986404722,1972809448,3945618910
%N a(n) = 2*a(n-1) + prime(n) - prime(n-1), a(1)=2, where prime(n) denotes the n-th prime.
%C Row sums of A125179.
%C Limit_{n->oo} a(n)/a(n-1) = 2.
%F a(n) = prime(n) + Sum_{j=1..n-1} 2^(n-j-1)*prime(j), where prime(k) denotes the k-th prime.
%F a(n) = Sum_{i=0..prime(n)-1} 2^(n-1-pi(i)), where prime(n) = A000040(n) and pi(n) = A000720(n). - _Ridouane Oudra_, Oct 17 2019
%F a(1) = 2 and a(n) = prime(n) + Sum_{i=1..n-1} a(i) for n > 1. - _Alexandre Herrera_, Dec 10 2023
%e a(4)=26 because 4*prime(1)+2*prime(2)+prime(3)+prime(4) = 8+6+5+7 = 26.
%p a[1]:=2: for n from 2 to 35 do a[n]:=2*a[n-1]+ithprime(n)-ithprime(n-1) od: seq(a[n],n=1..35);
%t a[1] = 2; a[n_] := 2*a[n - 1] + Prime[n] - Prime[n - 1]; Table[a[n], {n, 1, 31}] (* _James C. McMahon_, Dec 10 2023 *)
%o (Magma) [n eq 1 select 2 else 2*Self(n-1)+NthPrime(n)-NthPrime(n-1):n in [1..31]]; // _Marius A. Burtea_, Oct 17 2019
%Y Cf. A125179, A000040, A000720.
%K nonn
%O 1,1
%A _Gary W. Adamson_, Nov 22 2006
%E Edited by _N. J. A. Sloane_, Dec 02 2006