login
A243076
Let f(p,i) = smallest prime m >= p such that m == i (mod p); a(n) = Sum_{i=0..p-1} f(p,i), where p = n-th prime.
1
5, 15, 55, 119, 341, 533, 901, 1387, 1909, 3103, 4061, 5365, 6601, 7783, 9635, 12455, 16343, 17507, 20033, 24069, 27083, 29941, 33283, 42453, 47433, 53631, 54693, 60241, 66163, 69721, 86741, 92879, 104805, 102443, 126203, 130011, 136119, 143603, 157147
OFFSET
1,1
COMMENTS
a(n) is always odd.
From Robert G. Wilson v, Jun 21 2017: (Start)
Obviously, prime(n)|a(n) for n>1.
a(n)/prime(n), n>1: 5, 11, 17, 31, 41, 53, 73, 83, 107, 131, 145, 161, 181, 205, 235, 277, 287, 299, 339, etc.
Values of n such that a(n) < a(n-1): 34, 51, 57, 58, 65, 69, 71, 91, 96, 105, 109, 111, ....
(End)
LINKS
EXAMPLE
a(1) = 5 = 2+3,
a(2) = 15 = 3+7+5,
a(3) = 55 = 5+11+7+13+19,
a(4) = 119 = 7+29+23+17+11+19+13,
a(5) = 341 = 11+23+13+47+37+71+17+29+19+31+43, etc.
MATHEMATICA
f[n_] := Block[{p = Prime@ n, q, i = s = 0}, While[i < p, q = If[OddQ@ i, 2, 1]*p + i; While[ !PrimeQ@ q, q += 2p]; s += q; i++]; s]; f[1] = 5; Array[f, 100] (* Robert G. Wilson v, Jun 21 2017 *)
PROG
(PARI) a(n) = {res = 0; for (index = 0, prime(n)-1, m = n; while ((prime(m) % prime(n)) != index, m++; ); res += prime(m); ); res; } \\ Michel Marcus, Jun 04 2014
(Python)
from sympy import prime, isprime
def a(n):
if n==1: return 5
p=prime(n)
i=0
s=0
while i<p:
q=(2 if i%2 else 1)*p + i
while not isprime(q): q+=2*p
s+=q
i+=1
return s
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 22 2017, after Mathematica code
CROSSREFS
Sequence in context: A149584 A147324 A109245 * A002221 A007714 A123011
KEYWORD
nonn
AUTHOR
Torlach Rush, May 30 2014
EXTENSIONS
More terms from Michel Marcus, Jun 05 2014
Entry revised by N. J. A. Sloane, Jun 23 2017
Name corrected by Andrey Zabolotskiy, Dec 25 2023
STATUS
approved