OFFSET
2,1
LINKS
Robert Israel, Table of n, a(n) for n = 2..10000
EXAMPLE
For n=4, the composites between prime(4) and prime(5) are 8, 9, 10.
The numbers that divide at least one of these are {1,2,4,8} union {1,3,9} union {1,2,5,10} = {1,2,3,4,5,8,9,10}, and a(4) = 1+2+3+4+5+8+9+10 = 42.
MAPLE
f:= proc(n) local i, S;
S:= `union`(seq(numtheory:-divisors(i), i=ithprime(n)+1..ithprime(n+1)-1));
convert(S, `+`);
end proc:
map(f, [$2..100]);
MATHEMATICA
a[n_] := Divisors /@ Range[Prime[n]+1, Prime[n+1]-1] // Flatten // Union // Total;
Table[a[n], {n, 2, 100}] (* Jean-François Alcover, Feb 05 2023 *)
PROG
(PARI) a(n) = my(s=[]); for (c=prime(n)+1, prime(n+1)-1, s = setunion(s, divisors(c))); vecsum(s); \\ Michel Marcus, Jan 27 2021
(Python)
from sympy import prime, divisors
def a(n): return sum(set(d for c in range(prime(n)+1, prime(n+1)) for d in divisors(c)))
print([a(n) for n in range(2, 59)]) # Michael S. Branicky, Jul 12 2021
CROSSREFS
KEYWORD
nonn,look
AUTHOR
J. M. Bergot and Robert Israel, Jan 26 2021
STATUS
approved