cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A024934 Sum of remainders n mod p, over all primes p < n.

Original entry on oeis.org

0, 0, 0, 1, 1, 3, 1, 4, 6, 7, 4, 8, 8, 13, 10, 8, 12, 18, 20, 27, 28, 26, 21, 29, 33, 37, 31, 37, 37, 46, 46, 56, 65, 62, 54, 53, 59, 70, 61, 57, 62, 74, 75, 88, 89, 95, 84, 98, 108, 116, 124, 119, 119, 134, 145, 145, 152, 146, 131, 147, 154, 171, 156, 164, 180, 180, 182, 200, 200, 193, 198, 217
Offset: 0

Views

Author

Keywords

Examples

			a(5) = 3. The remainder when 5 is divided by primes 2, 3 respectively is 1, 2, and their sum = 3.
10 = 2*5+0 = 3*3+1 = 5*2+0 = 7*1+3: a(10) = 0+1+0+3 = 4.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Sum[Mod[n, Prime[i]], {i, PrimePi@ n}]; Array[a, 72, 0] (* Giovanni Resta, Jun 24 2016 *)
    Table[Total[Mod[n,Prime[Range[PrimePi[n]]]]],{n,0,80}] (* Harvey P. Dale, Jul 02 2025 *)
  • PARI
    a(n)=my(r=0);forprime(p=2,n,r+=n%p); r; \\ Joerg Arndt, Nov 05 2016

Formula

a(n) = n*A000720(n) - A024924(n). - Max Alekseyev, Feb 10 2012
a(n) = a(n-1) + A000720(n-1) - A105221(n). - Max Alekseyev, Nov 28 2017

Extensions

Edited by Max Alekseyev, Jan 30 2012
a(0)=0 prepended by Max Alekseyev, Dec 10 2013

A033955 a(n) = sum of the remainders when the n-th prime is divided by primes up to the (n-1)-th prime.

Original entry on oeis.org

0, 1, 3, 4, 8, 13, 18, 27, 29, 46, 56, 70, 74, 88, 98, 134, 147, 171, 200, 217, 252, 274, 309, 323, 348, 418, 448, 471, 522, 571, 629, 685, 739, 777, 793, 853, 954, 997, 1002, 1120, 1148, 1220, 1338, 1419, 1466, 1540, 1615, 1573, 1633, 1707, 1825, 1892, 1986
Offset: 1

Views

Author

Armand Turpel (armandt(AT)unforgettable.com)

Keywords

Comments

Row sums of A207409. - Bob Selcoe, Apr 14 2014

Examples

			a(5) = 8. The remainders when the fifth prime 11 is divided by 2, 3, 5, 7 are 1, 2, 1, 4, respectively and their sum = 8.
		

Crossrefs

Programs

  • Maple
    P:= [seq(ithprime(i),i=1..200)]:
    f:= proc(n) local j;  add(P[n] mod P[j],j=1..n-1) end proc:
    map(f, [$1..200]); # Robert Israel, Dec 29 2020
  • Mathematica
    a[n_] := Sum[Mod[Prime[n], Prime[i]], {i, 1, n-1}]
    Table[Total[Mod[Prime[n],Prime[Range[n-1]]]],{n,60}] (* Harvey P. Dale, Mar 07 2018 *)
  • PARI
    {for(n=1, 200, print1(sum(k=1, n, prime(n)%prime(k)), ", "))}
    
  • Python
    from sympy import prime; {print(sum(prime(n)%prime(k) for k in range(1,n)), end =', ') for n in range(1,54)} # Ya-Ping Lu, May 05 2024

Formula

a(n) = Sum_{k=1..n-1} ( prime(n) mod prime(k) ).

Extensions

Edited by Dean Hickerson, Mar 02 2002

A067436 a(n) = sum of all the remainders when n-th even number is divided by even numbers < 2n.

Original entry on oeis.org

0, 0, 2, 2, 8, 6, 16, 16, 24, 26, 44, 34, 56, 62, 72, 72, 102, 94, 128, 122, 140, 154, 196, 170, 206, 224, 250, 248, 302, 276, 334, 334, 368, 394, 436, 396, 466, 496, 538, 516, 594, 568, 650, 656, 678, 716, 806, 748, 828, 840, 898, 908, 1010, 984, 1058, 1040
Offset: 1

Views

Author

Amarnath Murthy, Jan 29 2002

Keywords

Examples

			a(5) = 8. The remainder when 10 is divided by 4,6,8, respectively is 2,4,2 and their sum = 8.
		

Crossrefs

Programs

  • Mathematica
    Accumulate[Table[4*n - 2*DivisorSigma[1, n] - 2, {n, 1, 100}]] (* Amiram Eldar, Mar 30 2024 *)
  • Python
    from math import isqrt
    def A067436(n): return (n**2<<1)+(s:=isqrt(n))**2*(s+1)-sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1)) # Chai Wah Wu, Oct 22 2023

Formula

a(n) = 2*A004125(n).
a(n) = (2 - Pi^2/6) * n^2 + O(n*log(n)). - Amiram Eldar, Mar 30 2024

Extensions

Corrected and extended by several contributors.

A067439 a(n) = sum of all the remainders when n is divided by positive integers less than and coprime to n.

Original entry on oeis.org

0, 0, 1, 1, 4, 1, 8, 6, 9, 5, 22, 8, 28, 15, 19, 20, 51, 20, 64, 30, 39, 33, 98, 33, 83, 56, 89, 55, 151, 46, 167, 95, 107, 95, 150, 71, 233, 120, 172, 106, 297, 92, 325, 163, 186, 162, 403, 144, 358, 189, 279, 217, 505, 173, 375, 230, 342, 276, 635, 165, 645, 338
Offset: 1

Views

Author

Amarnath Murthy, Jan 29 2002

Keywords

Examples

			a(8) = 6. The remainders when 8 is divided by the coprime numbers 1, 3, 5 and 7 are 0, 2, 3 and 1, whose sum = 6.
		

Crossrefs

Programs

  • Maple
    a := n -> add(ifelse(igcd(n, i) = 1, irem(n, i), 0), i = 1..n-1):
    seq(a(n), n = 1..62);  # Peter Luschny, May 14 2025
  • Mathematica
    a[n_] := Sum[If[GCD[i, n]>1, 0, Mod[n, i]], {i, 1, n-1}]
    Table[Total[Mod[n,#]&/@Select[Range[n-1],CoprimeQ[#,n]&]],{n,70}] (* Harvey P. Dale, May 22 2012 *)
  • PARI
    a(n)=sum(i=1,n-1,if(gcd(n,i)==1,n%i)) \\ Charles R Greathouse IV, Jul 17 2012

Formula

From Ridouane Oudra, May 14 2025: (Start)
a(n) = A004125(n) - A072514(n).
a(n) = Sum_{d|n} d*mu(d)*A004125(n/d).
a(n) = Sum_{d|n} mu(d)*f(n,d), where f(n,d) = Sum_{i=1..n/d} (n mod d*i).
a(p) = A004125(p), for p prime.
a(p^k) = A004125(p^k) - p*A004125(p^(k-1)), for p prime and k >= 0.
a(p^k) = A072514(p^(k+1))/p - A072514(p^k), for p prime and k >= 0. (End)

Extensions

Edited by Dean Hickerson, Feb 15 2002
Showing 1-4 of 4 results.