login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A050482 Sum of remainders when n-th prime is divided by all preceding integers. 3
0, 1, 4, 8, 22, 28, 51, 64, 98, 151, 167, 233, 297, 325, 403, 505, 635, 645, 790, 904, 923, 1113, 1244, 1422, 1654, 1800, 1888, 2056, 2098, 2256, 2849, 3066, 3326, 3450, 3969, 4045, 4329, 4696, 5014, 5325, 5767, 5759, 6499, 6565, 6898 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
a(n)/(n*log(n))^2 appears to approach a constant ~0.22... for large n. - Benedict W. J. Irwin, Dec 07 2016
Irwin's comment is incorrect. - Bill McEachen, Feb 04 2024. [Indeed, according to the first formula in A004125, a(n)/(n*log(n))^2 approaches a constant, which is not 0.22 but 1-Pi^2/12 = 0.1775... - Amiram Eldar, Feb 04 2024]
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A004125(A000040(n)). - R. J. Mathar, Jun 12 2009
EXAMPLE
a(4) = 8 because remainders when 7 is divided by 1..6 are 0,1,1,3,2,1, which add to 8.
a(2) = 3 mod (3-1) = 1.
a(3) = (5 mod (5-1)) + (5 mod (5-2)) + (5 mod (5-3)) = 2 + 1 + 1 = 4.
MAPLE
A050482 := proc(n) local a, i; a := 0; for i from 1 to ithprime(n)-1 do a := a+(ithprime(n) mod i); od: end;
MATHEMATICA
Table[Sum[Mod[Prime[n], k], {k, Prime[n]-1}], {n, 45}] (* James C. McMahon, Feb 08 2024 *)
PROG
(PARI) a(n)=my(p=prime(n)); sum(k=2, p, p%k) \\ Charles R Greathouse IV, Jun 03 2013
(Python)
from math import isqrt
from sympy import prime
def A050482(n): return (p:=prime(n))**2+((s:=isqrt(p))**2*(s+1)-sum((q:=p//k)*((k<<1)+q+1) for k in range(1, s+1))>>1) # Chai Wah Wu, Nov 01 2023
CROSSREFS
Sequence in context: A129794 A370956 A064503 * A323584 A332199 A200149
KEYWORD
nonn
AUTHOR
Brian Wallace (wallacebrianedward(AT)yahoo.co.uk), Dec 26 1999
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 20:33 EDT 2024. Contains 371916 sequences. (Running on oeis4.)