login
Sum of first n primes divided by the n-th prime, rounded up to the nearest integer.
2

%I #26 Jul 26 2024 21:31:17

%S 1,2,2,3,3,4,4,5,5,5,6,6,6,7,7,8,8,9,9,9,10,11,11,11,11,12,13,13,14,

%T 15,14,15,15,16,16,17,17,17,18,18,19,20,20,20,21,22,22,21,22,23,23,24,

%U 25,25,25,26,26,27,27,28,29,29,28,29,30,31,30,31,31,32,32,33,33,34,34,35

%N Sum of first n primes divided by the n-th prime, rounded up to the nearest integer.

%H L. Manor, <a href="/A165906/b165906.txt">Table of n, a(n) for n = 1..1000</a>

%F a(n) = ceiling(Sum_{j=1..n} prime(j)) / prime(n).

%e a(4) = ceiling((2 + 3 + 5 + 7)/7) = ceiling(17/7) = 3.

%t Module[{nn=80,pr},pr=Prime[Range[nn]];Ceiling[#[[2]]/#[[1]]]&/@ Thread[ {pr,Accumulate[pr]}]] (* _Harvey P. Dale_, Jan 29 2013 *)

%o (PARI) a(n) = ceil(sum(k=1, n, prime(k))/prime(n)); \\ _Michel Marcus_, Mar 21 2018

%o (PARI) first(n) = my(res = vector(n), p, s, i = 0); forprime(p = 2, , s += p; i++; res[i] = ceil(s / p); if(i==n, return(res))); \\ _David A. Corneth_, Mar 24 2018

%Y Cf. A007504, A165907.

%K easy,nonn

%O 1,2

%A _Lior Manor_, Sep 30 2009