A329970
a(n) = (-1)^(n + 1) * n * ceiling(n/2) + Sum_{k=1..n} (-1)^k * k^2 * floor(n/k).
Original entry on oeis.org
0, 0, -2, 3, 0, -3, -7, 16, 2, -15, -21, 31, 24, -15, -57, 34, 25, -17, -27, 77, 8, -99, -111, 155, 117, -36, -140, 40, 25, -80, -96, 259, 112, -157, -249, 202, 183, -156, -354, 224, 203, -40, -62, 342, -21, -524, -548, 562, 488, -34, -358, 194, 167, -262
Offset: 1
-
Table[(-1)^(n + 1) n Ceiling[n/2] + Sum[(-1)^k k^2 Floor[n/k], {k, 1, n}], {n, 1, 54}]
nmax = 54; CoefficientList[Series[x (1 - x + 2 x^2)/((1 - x)^2 (1 + x)^3) + 1/(1 - x) Sum[(-1)^k k^2 x^k/(1 - x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
Table[Sum[(-1)^(k + 1) Mod[n, k] k, {k, 1, n}], {n, 1, 54}]
-
a(n) = (-1)^(n + 1)*n*ceil(n/2) + sum(k=1, n, (-1)^k * k^2 * (n\k)); \\ Michel Marcus, Sep 20 2021
A024925
Sum of remainders of n mod prime(k), for k = 1,2,3,...,n.
Original entry on oeis.org
1, 2, 4, 9, 13, 19, 25, 38, 52, 64, 74, 92, 104, 122, 143, 172, 188, 218, 236, 268, 299, 329, 351, 393, 437, 473, 523, 569, 597, 646, 676, 737, 788, 836, 893, 959, 995, 1049, 1110, 1182, 1222, 1293, 1335, 1409, 1490, 1556, 1602, 1692, 1782, 1874, 1955, 2043, 2095, 2197, 2290
Offset: 1
-
[&+[n mod NthPrime(k): k in [1..n]]:n in [1..55]]; // Marius A. Burtea, Jul 16 2019
-
a(n) = sum(k=1, n, n % prime(k)); \\ Michel Marcus, Jul 18 2019
-
a(n) = my(s=0); forprime(p=2, prime(n), s += n%p); s; \\ Michel Marcus, Jul 18 2019
A161678
Sum of c mod k for k from (smallest prime factor of c) to (largest prime factor of c) where c is composite(n).
Original entry on oeis.org
0, 0, 0, 0, 3, 0, 10, 3, 0, 0, 2, 5, 22, 0, 0, 34, 0, 8, 2, 0, 22, 61, 5, 0, 77, 42, 1, 4, 26, 1, 105, 0, 0, 4, 59, 35, 0, 20, 5, 65, 172, 0, 207, 9, 0, 30, 17, 66, 123, 7, 0, 290, 3, 82, 17, 33, 2, 0, 343, 4, 48, 384, 197, 27, 2, 15, 99, 201, 470, 94, 0, 9, 23, 1, 61, 36, 4, 573, 0
Offset: 1
composite(2) = 6; (smallest prime factor of 6) = 2, (largest prime factor of 6) = 3. Hence a(2) = (6 mod 2)+(6 mod 3) = 0+0 = 0.
composite(5) = 10; (smallest prime factor of 10) = 2, (largest prime factor of 10) = 5. Hence a(5) = (10 mod 2)+(10 mod 3)+(10 mod 4)+(10 mod 5) = 0+1+2+0 = 3.
composite(7) = 14; (smallest prime factor of 14) = 2, (largest prime factor of 14) = 7. Hence a(7) = (14 mod 2)+(14 mod 3)+(14 mod 4)+(14 mod 5)+(14 mod 6)+(14 mod 7) = 0+2+2+4+2+0 = 10.
Cf.
A002808 (composite numbers),
A004125 (sum of n mod k for k=1..n),
A161517 (sum of c mod k for k=1..c where c is composite(n)).
Edited, corrected (a(22)=63 replaced by 61, a(25)=78 replaced by 77) and extended by
Klaus Brockhaus, Jun 24 2009
A166247
Number of perfect partitions of n-1 plus sum of remainders of n mod k, for k=1,2,3,..,n.
Original entry on oeis.org
1, 1, 2, 3, 5, 6, 9, 12, 14, 16, 23, 25, 29, 34, 39, 44, 52, 55, 65, 69, 73, 80, 99, 105, 105, 115, 129, 132, 152, 151, 168, 183, 187, 200, 221, 224, 234, 251, 272, 278, 298, 297, 326, 336, 347, 361, 404, 422, 416, 428, 452, 462, 506, 512, 532, 540, 556, 581, 636
Offset: 1
Indices in definition and formula corrected by
R. J. Mathar, May 21 2010
A302800
Irregular triangle read by rows: T(n,k) is the area of the k-th region of the diagram with n rows described in A237591.
Original entry on oeis.org
1, 3, 5, 1, 8, 2, 11, 4, 15, 5, 1, 19, 7, 2, 24, 9, 3, 29, 11, 5, 35, 13, 6, 1, 41, 16, 7, 2, 48, 18, 9, 3, 55, 21, 11, 4, 63, 24, 12, 6, 71, 27, 14, 7, 1, 80, 30, 16, 8, 2, 89, 34, 18, 9, 3, 99, 37, 20, 11, 4, 109, 41, 22, 13, 5, 120, 45, 24, 14, 7, 131, 49, 27, 15, 8, 1, 143, 53, 29, 17, 9, 2
Offset: 1
Triangle begins:
1;
3;
5, 1;
8, 2;
11, 4;
15, 5, 1;
19, 7, 2;
24, 9, 3;
29, 11, 5;
35, 13, 6, 1;
41, 16, 7, 2;
48, 18, 9, 3;
55, 21, 11, 4;
63, 24, 12, 6;
71, 27, 14, 7, 1;
80, 30, 16, 8, 2;
89, 34, 18, 9, 3;
99, 37, 20, 11, 4;
109, 41, 22, 13, 5;
120, 45, 24, 14, 7;
131, 49, 27, 15, 8, 1;
...
Illustration for n = 10:
We draw the first 10 rows of the infinite diagram described in A237591 as shown below:
Row _
1 _| |
2 _| _|
3 _| | |
4 _| _| |
5 _| | _|
6 _| _| | |
7 _| | | |
8 _| _| _| |
9 _| | | _|
10 |_ _ _ _ _ _|_ _|_|_|
Area 35 13 6 1
.
The diagram contains four regions and the areas of the successives regions from left to right are respectively [35, 13, 6, 1], so the 10th row of this triangle is [35, 13, 6, 1].
Note that this infinite diagram gives a correspondence between the number of partitions into k consecutive parts and the symmetric representation of A000203, A024916, A004125 and many other integer sequences. For more information see A196020, A236104, A235791, A237048, A237593, A262626, A286000 and A286001.
Column 1 gives
A024206 without its initial zero.
Column 2 gives the partial sums of the
A261348.
Cf.
A000203,
A004125,
A024916,
A196020,
A235791,
A236104,
A237048,
A237591,
A237593,
A244050,
A245092,
A262626,
A286000,
A286001.
A341270
a(n) = Sum_{k=1..n} a(n mod k) for n > 0; a(0) = 1.
Original entry on oeis.org
1, 1, 2, 3, 4, 6, 7, 10, 12, 15, 17, 25, 24, 32, 37, 45, 46, 63, 62, 82, 83, 97, 104, 141, 130, 158, 170, 201, 202, 255, 242, 302, 306, 350, 367, 448, 416, 503, 522, 610, 597, 716, 690, 825, 832, 921, 945, 1147, 1085, 1255, 1272, 1430, 1435, 1683, 1631, 1888
Offset: 0
a(1) = a(1 mod 1) = a(0) = 1.
a(2) = a(2 mod 1)+a(2 mod 2) = a(0)+a(0) = 2.
a(3) = a(3 mod 1)+a(3 mod 2)+a(3 mod 3) = a(0)+a(1)+a(0) = 3.
For Sum_{k=1..n} n mod k see
A004125.
For Max_{k=1..n} a(n mod k)+1 see
A113473.
-
a:= proc(n) option remember;
`if`(n=0, 1, add(a(n mod k), k=1..n))
end:
seq(a(n), n=0..62); # Alois P. Heinz, Feb 07 2021
-
a[0] = 1; a[n_] := a[n] = Sum[a[Mod[n, k]], {k, 1, n}]; Array[a, 50, 0] (* Amiram Eldar, Feb 08 2021 *)
-
a(n) = if (n==0, 1, sum(k=1, n, a(n % k))); \\ Michel Marcus, Feb 08 2021
-
a = [1]
for n in range(1,1000):
a.append(sum(a[n%k] for k in range(1,n+1)))
A380231
Alternating row sums of triangle A237591.
Original entry on oeis.org
1, 2, 1, 2, 1, 4, 3, 4, 5, 4, 3, 6, 5, 4, 7, 8, 7, 8, 7, 10, 9, 8, 7, 10, 11, 10, 9, 12, 11, 14, 13, 14, 13, 12, 15, 16, 15, 14, 13, 16, 15, 18, 17, 16, 19, 18, 17, 20, 21, 22, 21, 20, 19, 22, 21, 24, 23, 22, 21, 24, 23, 22, 25, 26, 25, 28, 27, 26, 25, 28, 27, 32, 31, 30, 29, 28, 31, 30, 29
Offset: 1
For n = 14 the 14th row of A237591 is [8, 3, 1, 2] hence the alternating row sum is 8 - 3 + 1 - 2 = 4, so a(14) = 4.
On the other hand the 14th row of A237593 is the 14th row of A237591 together with the 14 th row of A237591 in reverse order as follows: [8, 3, 1, 2, 2, 1, 3, 8].
Then with the terms of the 14th row of A237593 we can draw a Dyck path in the first quadrant of the square grid as shown below:
.
(y axis)
.
.
. (4,14) (14,14)
._ _ _ . _ _ _ _ .
. |
. |
. |_
. |
. |_ _
. C |_ _ _
. |
. |
. |
. |
. . (14,4)
. |
. |
. . . . . . . . . . . . . . | . . . (x axis)
(0,0)
.
In the example the point C is the point (9,9).
The three line segments [(4,14),(9,9)], [(14,4),(9,9)] and [(14,14),(9,9)] have the same length.
The points (14,14), (9,9) and (4,14) are the vertices of a virtual isosceles right triangle.
The points (14,14), (9,9) and (14,4) are the vertices of a virtual isosceles right triangle.
The points (4,14), (14,14) and (14,4) are the vertices of a virtual isosceles right triangle.
Other alternating row sums (ARS) related to the Dyck paths of
A237593 and the stepped pyramid described in
A245092 are as follows:
-
A380231[n_] := 2*Sum[(-1)^(k + 1)*Ceiling[(n + 1)/k - (k + 1)/2], {k, Quotient[Sqrt[8*n + 1] - 1, 2]}] - n;
Array[A380231 , 100] (* Paolo Xausa, Sep 06 2025 *)
-
row235791(n) = vector((sqrtint(8*n+1)-1)\2, i, 1+(n-(i*(i+1)/2))\i);
a(n) = my(orow = concat(row235791(n), 0)); vecsum(vector(#orow-1, i, (-1)^(i+1)*(orow[i] - orow[i+1]))); \\ Michel Marcus, Apr 13 2025
Comments