login
Sum of composite numbers between successive primes.
44

%I #38 Jun 01 2024 20:02:25

%S 0,4,6,27,12,45,18,63,130,30,170,117,42,135,250,280,60,320,207,72,380,

%T 243,430,651,297,102,315,108,333,1560,387,670,138,1296,150,770,800,

%U 495,850,880,180,1674,192,585,198,2255,2387,675,228,693,1180,240,2214,1270

%N Sum of composite numbers between successive primes.

%H James Spahlinger, <a href="/A054265/b054265.txt">Table of n, a(n) for n = 1..1000</a>

%H Paul Barry, <a href="https://arxiv.org/abs/2104.05593">On the Gap-sum and Gap-product Sequences of Integer Sequences</a>, arXiv:2104.05593 [math.CO], 2021.

%F a(n) = (prime(n+1) + prime(n))*(prime(n+1) - prime(n) - 1)/2. - _Zak Seidov_, Sep 12 2002

%e Between 7 and 11 we have 8 + 9 + 10 which is a(4)=27.

%o (PARI) a(n) = (prime(n+1) + prime(n))*(prime(n+1) - prime(n) - 1)/2; \\ _Michel Marcus_, Mar 24 2016

%o (Python)

%o from sympy import nextprime, prime

%o def A054265(n): return ((p:=prime(n))+(q:=nextprime(p)))*(q-p-1)>>1 # _Chai Wah Wu_, Jun 01 2024

%Y Cf. A000040, A046933, A054264, A054266, A054267, A054268.

%K nonn

%O 1,2

%A _Patrick De Geest_, Apr 15 2000