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-8 of 8 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

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

A327329 Twice the sum of all divisors of all positive integers <= n.

Original entry on oeis.org

2, 8, 16, 30, 42, 66, 82, 112, 138, 174, 198, 254, 282, 330, 378, 440, 476, 554, 594, 678, 742, 814, 862, 982, 1044, 1128, 1208, 1320, 1380, 1524, 1588, 1714, 1810, 1918, 2014, 2196, 2272, 2392, 2504, 2684, 2768, 2960, 3048, 3216, 3372, 3516, 3612, 3860, 3974, 4160, 4304, 4500, 4608, 4848, 4992
Offset: 1

Views

Author

Omar E. Pol, Sep 25 2019

Keywords

Comments

a(n) has a symmetric representation. Using two opposite quadrants, where in each quadrant there is the Dyck path related to partitions described in the n-th row of triangle A237593, a(n) is the total area (or the total number of cells) of the structure (see the example).
a(n) is also the total area of the horizontal faces in the stepped pyramid with n levels described in A245092 (that is the total area of the terraces plus the area of the base). - Omar E. Pol, Dec 15 2021

Examples

			Illustration of a(8) = 112 using a symmetric structure constructed with the Dyck path related to partitions described in the 8th row of triangle A237593.
                           _ _ _ _ _
                          |         |
                          |         |_
                          |           |_ _
                          |               |
                          |     56        |
                          |               |
                          |               |
           _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _|
          |               |
          |               |
          |               |
          |       56      |
          |_ _            |
              |_          |
                |         |
                |_ _ _ _ _|
		

Crossrefs

Programs

  • Mathematica
    Accumulate[2*DivisorSigma[1,Range[60]]] (* Harvey P. Dale, Sep 25 2021 *)
  • PARI
    a(n) = 2*sum(k=1, n, sigma(k)); \\ Michel Marcus, Dec 20 2021
    
  • Python
    from sympy import divisor_sigma
    from itertools import accumulate
    def f(, n): return  + 2*divisor_sigma(n, 1)
    def aupton(terms): return list(accumulate(range(terms+1), f))[1:]
    print(aupton(55)) # Michael S. Branicky, Dec 16 2021
    
  • Python
    from math import isqrt
    def A327329(n): return -(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*A024916(n).
a(n) = A243980(n)/2.
a(n) = A006218(n) + A222548(n).
a(n) = A001105(n) - A067436(n).
lim_{n->infinity} a(n)/(n^2) = Pi^2/6 = zeta(2) (cf. A013661). - Omar E. Pol, Dec 16 2021

A294016 a(n) = sum of all divisors of all positive integers <= n, minus the sum of remainders of n mod k, for k = 1, 2, 3, ..., n.

Original entry on oeis.org

1, 4, 7, 14, 17, 30, 33, 48, 57, 74, 77, 110, 113, 134, 153, 184, 187, 230, 233, 278, 301, 330, 333, 406, 419, 452, 479, 536, 539, 624, 627, 690, 721, 762, 789, 900, 903, 948, 983, 1084, 1087, 1196, 1199, 1280, 1347, 1400, 1403, 1556, 1573, 1660, 1703, 1796, 1799, 1932, 1967, 2096, 2143, 2208, 2211, 2428, 2431, 2500
Offset: 1

Views

Author

Omar E. Pol, Oct 22 2017

Keywords

Comments

a(n) is also the area (also the number of cells) of the n-th polygon formed by the Dyck path described in A237593 and its mirror, as shown below in the example.
a(n) is also the volume (and the number of cubes) in the n-th level (starting from the top) of the pyramid described in A294017.

Examples

			Illustration of initial terms:
.
.   _ 1
.  |_|_ _ 4
.    |   |
.    |_ _|_ _   7
.        |   |_
.        |_    |
.          |_ _|_ _ _  14
.              |     |_
.              |       |
.              |_      |
.                |_ _ _|_ _ _
.                      |     |  17
.                      |     |_ _
.                      |_ _      |
.                          |     |
.                          |_ _ _|_ _ _ _
.                                |       |_  30
.                                |         |_
.                                |           |
.                                |_          |
.                                  |_        |
.                                    |_ _ _ _|_ _ _ _
.                                            |       |
.                                            |       |_  33
.                                            |         |_ _
.                                            |_ _          |
.                                                |_        |
.                                                  |       |
.                                                  |_ _ _ _|
.
		

Crossrefs

Programs

  • Maple
    A294016 := proc(n)
        A024916(n)-A004125(n) ;
    end proc:
    seq(A294016(n),n=1..80) ; # R. J. Mathar, Nov 07 2017
  • Mathematica
    Accumulate[Table[2*(DivisorSigma[1, n] - n) + 1, {n, 1, 100}]] (* Amiram Eldar, Mar 30 2024 *)
  • Python
    from math import isqrt
    def A294016(n): return -(s:=isqrt(n))**2*(s+1)+sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1))-n**2 # Chai Wah Wu, Oct 22 2023

Formula

a(n) = A024916(n) - A004125(n).
a(n) = A000290(n) - A067436(n).
From Omar E. Pol, Nov 05 2017: (Start)
a(n) = A000203(n) + A024816(n) + A153485(n) - A004125(n).
a(n) = A000217(n) + A153485(n) - A004125(n).
a(n) = A000203(n) + A153485(n) + A244048(n). (End)
a(n) = (Pi^2/6 - 1) * n^2 + O(n*log(n)). - Amiram Eldar, Mar 30 2024

A067435 a(n) is the sum of all the remainders when n-th odd number is divided by odd numbers < 2n-1.

Original entry on oeis.org

0, 0, 2, 3, 6, 9, 16, 13, 27, 31, 34, 43, 57, 56, 75, 80, 96, 99, 121, 122, 155, 164, 163, 184, 220, 218, 255, 252, 277, 304, 339, 328, 372, 389, 412, 433, 491, 478, 515, 536, 570, 609, 638, 647, 722, 713, 746, 767, 858, 842, 910, 939, 942, 993, 1060, 1057
Offset: 1

Views

Author

Amarnath Murthy, Jan 29 2002

Keywords

Examples

			a(7) = 16 = 1 +3 +6 +4 +2 = 13 % 3 + 13 % 5 + 13 % 7 + 13 % 9 + 13 % 11.
		

Crossrefs

Programs

  • Maple
    L:= [seq(4*n-3 - numtheory:-sigma(2*n-1)-numtheory:-sigma((n-1)/2^padic:-ordp(n-1,2)), n=1..100)]:
    ListTools:-PartialSums(L); # Robert Israel, Jan 16 2019
  • Python
    from math import isqrt
    def A327329(n): return -(s:=isqrt(n))**2*(s+1)+sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1))
    def A067435(n): return n*((n<<1)-1)-(A327329(n<<1)>>1)-A327329(n>>1)+3*(A327329(n)>>1)+A327329(n-1>>1)-(A327329(n-1)>>1) # Chai Wah Wu, Nov 01 2023

Formula

a(n) = a(n-1) + 4*n-3 - A000203(2*n-1) - A000593(n-1). - Robert Israel, Jan 16 2019
a(n) = n*(2*n-1) - A326123(n) - A078471(n-1) = n*(2*n-1) - A024916(2*n) - 2*A024916(floor(n/2)) + 3*A024916(n) + 2*A024916(floor((n-1)/2)) - A024916(n-1). - Chai Wah Wu, Nov 01 2023

Extensions

Corrected and extended by several contributors.

A235799 a(n) = n^2 - sigma(n).

Original entry on oeis.org

0, 1, 5, 9, 19, 24, 41, 49, 68, 82, 109, 116, 155, 172, 201, 225, 271, 285, 341, 358, 409, 448, 505, 516, 594, 634, 689, 728, 811, 828, 929, 961, 1041, 1102, 1177, 1205, 1331, 1384, 1465, 1510, 1639, 1668, 1805, 1852, 1947, 2044, 2161, 2180, 2344, 2407
Offset: 1

Views

Author

Omar E. Pol, Jan 24 2014

Keywords

Comments

From Omar E. Pol, Apr 11 2021: (Start)
If n is prime (A000040) then a(n) = n^2 - n - 1.
If n is a power of 2 (A000079) then a(n) = (n-1)^2.
If n is a perfect number (A000396) then a(n) = (n-1)^2 - 1, assuming there are no odd perfect numbers.
In order to construct the diagram of the symmetric representation of a(n) we use the following rules:
At stage 1 in the first quadrant of the square grid we draw the symmetric representation of sigma(n) using the two Dyck paths described in the rows n and n-1 of A237593. The area of the region that is below the symmetric representation of sigma(n) equals A024916(n-1).
At stage 2 we draw a pair of orthogonal line segments (if it's necessary) such that in the drawing appears totally formed a square n X n. The area of the region that is above the symmetric representation of sigma(n) equals A004125(n).
At stage 3 we turn OFF the cells of the symmetric representation of sigma(n). Then we turn ON the rest of the cells that are in the square n X n. The result is that the ON cell form the diagram of the symmetric representation of a(n). See the Example section. (End)

Examples

			From _Omar E. Pol, Apr 04 2021: (Start)
Illustration of initial terms in the first quadrant for n = 1..6:
.
.                                                             y|        _ _
.                                              y|      _ _     |_ _ _  |_  |
.                                 y|      _     |_ _ _|   |    |     |   |_|
.                      y|    _     |_ _  |_|    |        _|    |     |_ _
.             y|        |_ _|_|    |   |_       |       |      |         |
.      y|      |_       |   |      |     |      |       |      |         |
.       |_ _   |_|_ _   |_ _|_ _   |_ _ _|_ _   |_ _ _ _|_ _   |_ _ _ _ _|_ _
.          x        x          x            x              x                x
.
n:        1       2         3           4             5               6
a(n):     0       1         5           9            19              24
.
Illustration of initial terms in the first quadrant for n = 7..9:
.                                                y|          _ _ _ _
.                          y|          _ _ _      |_ _ _ _ _|       |
.      y|        _ _ _      |_ _ _ _  |     |     |          _ _    |
.       |_ _ _ _|     |     |       | |_    |     |         |_  |   |
.       |             |     |       |_  |_ _|     |           |_|  _|
.       |            _|     |         |_ _        |               |
.       |           |       |             |       |               |
.       |           |       |             |       |               |
.       |           |       |             |       |               |
.       |_ _ _ _ _ _|_ _    |_ _ _ _ _ _ _|_ _    |_ _ _ _ _ _ _ _|_ _
.                      x                     x                       x
.
n:              7                    8                      9
a(n):          41                   49                     68
.
For n = 9 the figures 1, 2 and 3 below show respectively the three stages described in the Comments section as follows:
.
.   y|_ _ _ _ _ 5            y|_ _ _ _ _ _ _ _ _      y|          _ _ _ _
.    |_ _ _ _ _|              |_ _ _ _ _|       |      |_ _ _ _ _|       |
.    |         |_ _ 3         |         |_ _ R  |      |          _ _    |
.    |         |_  |          |         |_  |   |      |         |_  |   |
.    |           |_|_ _ 5     |           |_|_ _|      |           |_|  _|
.    |               | |      |               | |      |               |
.    |      Q        | |      |       Q       | |      |               |
.    |               | |      |               | |      |               |
.    |               | |      |               | |      |               |
.    |_ _ _ _ _ _ _ _|_|_     |_ _ _ _ _ _ _ _|_|_     |_ _ _ _ _ _ _ _|_ _
.                       x                        x                        x
.         Figure 1.                Figure 2.                Figure 3.
.         Symmetric                Symmetric                Symmetric
.       representation           representation           representation
.         of sigma(9)              of sigma(9)             of a(9) = 68
.       A000203(9) = 13          A000203(9) = 13
.           and of                   and of
.     Q = A024916(8) = 56      R = A004125(9) = 12
.                              Q = A024916(8) = 56
.
Note that the symmetric representation of a(9) contains a hole formed by three cells because these three cells were the central part of the symmetric representation of sigma(9). (End)
		

Crossrefs

Programs

  • Magma
    [n^2 - DivisorSigma(1,n): n in [1..50]]; // G. C. Greubel, Oct 31 2018
  • Mathematica
    Table[n^2-DivisorSigma[1,n],{n,50}] (* Harvey P. Dale, Sep 02 2016 *)
  • PARI
    vector(50, n, n^2 - sigma(n)) \\ G. C. Greubel, Oct 31 2018
    

Formula

a(n) = A000290(n) - A000203(n).
a(n) = A024916(n-1) + A004125(n), n > 1.
G.f.: x*(1 + x)/(1 - x)^3 - Sum_{k>=1} x^k/(1 - x^k)^2. - Ilya Gutkovskiy, Mar 17 2017
From Omar E. Pol, Apr 10 2021: (Start)
a(n) = A024816(n) + A000217(n-1).
a(n) = A067436(n) + A153485(n) + A244048(n). (End)

A294629 Partial sums of A294628.

Original entry on oeis.org

4, 16, 28, 56, 68, 120, 132, 192, 228, 296, 308, 440, 452, 536, 612, 736, 748, 920, 932, 1112, 1204, 1320, 1332, 1624, 1676, 1808, 1916, 2144, 2156, 2496, 2508, 2760, 2884, 3048, 3156, 3600, 3612, 3792, 3932, 4336, 4348, 4784, 4796, 5120, 5388, 5600, 5612, 6224, 6292, 6640, 6812, 7184, 7196, 7728, 7868, 8384
Offset: 1

Views

Author

Omar E. Pol, Nov 05 2017

Keywords

Comments

a(n) is also the volume (and the number of cubes) in the n-th level (starting from the top) of the stepped pyramid described in A294630.
Number of terms less than 10^k, k=1,2,3,...: 1, 5, 19, 61, 195, 623, 1967, 6225, ... - Muniru A Asiru, Mar 04 2018

Examples

			Illustration of initial terms (n = 1..6):
.                                                  _ _ _ _ _ _
.                                _ _ _ _         _|     |     |_
.                _ _ _ _       _|   |   |_      |       |       |
.      _ _      |   |   |     |    _|_    |     |      _|_      |
.     |_|_|     |_ _|_ _|     |_ _|   |_ _|     |_ _ _|   |_ _ _|
.     |_|_|     |   |   |     |   |_ _|   |     |     |_ _|     |
.               |_ _|_ _|     |_    |    _|     |       |       |
.       4                       |_ _|_ _|       |_      |      _|
.                  16                             |_ _ _|_ _ _|
.                                  28
.                                                      56
.
.                                        _ _ _ _ _ _ _ _
.             _ _ _ _ _ _              _|       |       |_
.            |     |     |           _|         |         |_
.         _ _|     |     |_ _       |           |           |
.        |      _ _|_ _      |      |          _|_          |
.        |     |       |     |      |        _|   |_        |
.        |_ _ _|       |_ _ _|      |_ _ _ _|       |_ _ _ _|
.        |     |       |     |      |       |_     _|       |
.        |     |_ _ _ _|     |      |         |_ _|         |
.        |_ _      |      _ _|      |           |           |
.            |     |     |          |_          |          _|
.            |_ _ _|_ _ _|            |_        |        _|
.                                       |_ _ _ _|_ _ _ _|
.                 68
.                                              120
.
Note that for n >= 2 the structure has a hole (or hollow) in the center.
a(n) is the number of ON cells in the n-th diagram.
		

Crossrefs

For other related diagrams see A294630 (partial sums), A294016 and A237593.

Programs

  • GAP
    List([1..1000],n->Sum([1..n],k->8*(Sigma(k)-k+(1/2)))); # Muniru A Asiru, Mar 04 2018
    
  • Maple
    with(numtheory): seq(sum(8*(sigma(k)-k+(1/2)),k=1..n),n=1..1000); # Muniru A Asiru, Mar 04 2018
  • Mathematica
    f[n_] := 8 (DivisorSigma[1, n] - n) + 4; Accumulate@Array[f, 56] (* Robert G. Wilson v, Dec 12 2017 *)
  • PARI
    a(n) = 4*(sum(k=1, n, n\k*k) - sum(k=2, n, n%k)) \\ Iain Fox, Dec 10 2017
    
  • PARI
    first(n) = my(res = vector(n)); res[1] = 4; for(x=2, n, res[x] = res[x-1] + 8*(sigma(x) - x + (1/2))); res; \\ Iain Fox, Dec 10 2017
    
  • Python
    from math import isqrt
    def A294629(n): return -(s:=isqrt(n))**2*(s+1)+sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1))-n**2<<2 # Chai Wah Wu, Oct 22 2023

Formula

a(n) = 4*A294016(n).
a(n) = A016742(n) - 8*A004125(n).
a(n) = A016742(n) - 4*A067436(n).
a(n) = A243980(n) - 4*A004125(n).
a(n) = A243980(n) - 2*A067436(n).
Showing 1-8 of 8 results.