login
A099850
Partial sums of A004648.
4
0, 1, 3, 6, 7, 8, 11, 14, 19, 28, 37, 38, 40, 41, 43, 48, 56, 63, 73, 84, 94, 107, 121, 138, 160, 183, 205, 228, 250, 273, 276, 279, 284, 287, 296, 303, 312, 323, 334, 347, 362, 375, 394, 411, 428, 443, 466, 497, 528, 557, 586, 617, 646, 681, 718, 757, 798, 837
OFFSET
1,3
FORMULA
a(n) = Sum_{k=1..n} A004648(k).
EXAMPLE
A004648 begins: 0, 1, 2, 3, 1, 1, 3, 3, 5, 9, 9, ... so the partial sums are 0, 1, 3, 6, 7, 8, 11, 14, 19, 28, 37, ...
MATHEMATICA
Table[Sum[Mod[Prime[j], j], {j, n}], {n, 100}] (* G. C. Greubel, Apr 20 2023 *)
Accumulate[Table[Mod[Prime[n], n], {n, 100}]] (* Harvey P. Dale, Jun 14 2023 *)
PROG
(PARI) s=vector(100):s[1]=prime(1)%1:for(n=2, 100, s[n]=s[n-1]+prime(n)%n)
(Magma) [(&+[(NthPrime(k) mod k): k in [1..n]]): n in [1..100]]; // G. C. Greubel, Apr 20 2023
(SageMath)
def A004648(n): return (nth_prime(n)%n)
def A099850(n): return sum(A004648(k) for k in range(1, n+1))
[A099850(n) for n in range(1, 101)] # G. C. Greubel, Apr 20 2023
CROSSREFS
Cf. A004648.
Sequence in context: A047557 A342736 A284390 * A310132 A189659 A157041
KEYWORD
easy,nonn
AUTHOR
Mark Hudson (mrmarkhudson(AT)hotmail.com), Oct 27 2004
STATUS
approved