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-10 of 22 results. Next

A268057 Triangle T(n,k), 1<=k<=n, read by rows: T(n,k) = number of iterations of A048158(n, A048158(n, ... A048158(n, k)...)) to reach 0.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 3, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 3, 3, 2, 1, 1, 1, 2, 1, 3, 2, 2, 1, 1, 2, 1, 2, 3, 2, 3, 2, 1, 1, 1, 2, 2, 1, 3, 3, 2, 2, 1, 1, 2, 3, 4, 2, 3, 5, 4, 3, 2, 1, 1, 1, 1, 1, 2, 1, 3, 2, 2, 2, 2, 1, 1, 2, 2, 2, 3, 2, 3, 4, 3
Offset: 1

Views

Author

Peter Kagey, Jan 25 2016

Keywords

Comments

Each column is periodic: T(n+A003418(k),k) = T(n,k). - Robert Israel, Feb 02 2016

Examples

			T(5, 3) = 3 because the algorithm requires three steps to reach 0.
  5 % 3 = 2
  5 % 2 = 1
  5 % 1 = 0
Triangle begins:
  1
  1 1
  1 2 1
  1 1 2 1
  1 2 3 2 1
  1 1 1 2 2 1
  1 2 2 3 3 2 1
  1 1 2 1 3 2 2 1
  1 2 1 2 3 2 3 2 1
  1 1 2 2 1 3 3 2 2 1
  1 2 3 4 2 3 5 4 3 2 1
  1 1 1 1 2 1 3 2 2 2 2 1
		

Crossrefs

Programs

  • Maple
    T:= proc(n,k) option remember; local m;
         if k = 0 then 0 else 1 + procname(n,n mod k) fi
    end proc:
    seq(seq(T(n,k),k=1..n),n=1..30); # Robert Israel, Feb 02 2016
  • Mathematica
    T[n_, k_] := T[n, k] = If[k == 0, 0, 1 + T[n, Mod[n, k]]];
    Table[Table[T[n, k], {k, 1, n}], {n, 1, 30}] // Flatten (* Jean-François Alcover, Jan 31 2023, after Robert Israel *)

A236109 Triangle read by rows: another version of A048158, only here the representation of A004125 is symmetric, as in the representation of A024916 and A000203.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 2, 3, 3, 0, 0, 0, 0, 0, 2, 3, 3, 0, 0, 0, 0, 0, 2, 2, 4, 4, 0, 0, 0, 0, 0, 0, 2, 3, 4, 4, 0, 0, 0, 0, 0, 0, 3, 4, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 5, 5, 0, 0, 0, 0, 0, 0, 0, 3
Offset: 1

Views

Author

Omar E. Pol, Jan 26 2014

Keywords

Comments

Row sums give A004125.
For more information see A236104, A237591, A237593, A237270.

Examples

			Triangle begins:
0;
0, 0;
0, 0, 1;
0, 0, 0, 1;
0, 0, 0, 2, 2;
0, 0, 0, 0, 1, 2;
0, 0, 0, 0, 2, 3, 3;
0, 0, 0, 0, 0, 2, 3, 3;
0, 0, 0, 0, 0, 2, 2, 4, 4;
0, 0, 0, 0, 0, 0, 2, 3, 4, 4;
0, 0, 0, 0, 0, 0, 3, 4, 5, 5, 5;
0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 5, 5;
...
For the symmetric representation of A000203, A024916, A004125 in the fourth quadrant using a diagram which arises from the sequence A236104 see below:
--------------------------------------------------
n     A000203  A024916            Diagram
--------------------------------------------------
.                         _ _ _ _ _ _ _ _ _ _ _ _
1        1        1      |_| | | | | | | | | | | |
2        3        4      |_ _|_| | | | | | | | | |
3        4        8      |_ _|  _|_| | | | | | | |
4        7       15      |_ _ _|    _|_| | | | | |
5        6       21      |_ _ _|  _|  _ _|_| | | |
6       12       33      |_ _ _ _|  _| |  _ _|_| |
7        8       41      |_ _ _ _| |_ _|_|    _ _|
8       15       56      |_ _ _ _ _|  _|     |* *
9       13       69      |_ _ _ _ _| |      _|* *
10      18       87      |_ _ _ _ _ _|  _ _|* * *
11      12       99      |_ _ _ _ _ _| |* * * * *
12      28      127      |_ _ _ _ _ _ _|* * * * *
.
The 12th row is ........ 0,0,0,0,0,0,0,2,2,3,5,5
.
The total number of cells in the first n set of symmetric regions of the diagram equals A024916(n). It appears that the total number of cells in the n-th set of symmetric regions of the diagram equals sigma(n) = A000203(n). Example: for n = 12 the 12th row of triangle is 144, 25, 9, 1, hence the alternating sums is 144 - 25 + 9 - 1 = 127. On the other hand we have that A000290(12) - A004125(12) = 144 - 17 = A024916(12) = 127, equaling the total number of cells in the diagram after 12 stages. The number of cells in the 12th set of symmetric regions of the diagram is sigma(12) = A000203(12) = 28. Note that in this case there is only one region. The number of "*"'s is A004125(12) = 17.
		

Crossrefs

A051731 Triangle read by rows: T(n, k) = 1 if k divides n, T(n, k) = 0 otherwise, for 1 <= k <= n.

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1
Offset: 1

Views

Author

Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de)

Keywords

Comments

T(n, k) is the number of partitions of n into k equal parts. - Omar E. Pol, Apr 21 2018
This triangle is the lower triangular array L in the LU decomposition of the square array A003989. - Peter Bala, Oct 15 2023

Examples

			The triangle T(n, k) begins:
  n\k 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 ...
  1:  1
  2:  1  1
  3:  1  0  1
  4:  1  1  0  1
  5:  1  0  0  0  1
  6:  1  1  1  0  0  1
  7:  1  0  0  0  0  0  1
  8:  1  1  0  1  0  0  0  1
  9:  1  0  1  0  0  0  0  0  1
  10: 1  1  0  0  1  0  0  0  0  1
  11: 1  0  0  0  0  0  0  0  0  0  1
  12: 1  1  1  1  0  1  0  0  0  0  0  1
  13: 1  0  0  0  0  0  0  0  0  0  0  0  1
  14: 1  1  0  0  0  0  1  0  0  0  0  0  0  1
  15: 1  0  1  0  1  0  0  0  0  0  0  0  0  0  1
  ... Reformatted and extended. - _Wolfdieter Lang_, Nov 12 2014
		

Crossrefs

Cf. A000005 (row sums), A032741(n+2) (diagonal sums).
Cf. A243987 (partial sums per row).
Cf. A134546 (A004736 * T, matrix multiplication).
Variants: A113704, A077049, A077051.

Programs

  • Haskell
    a051731 n k = 0 ^ mod n k
    a051731_row n = a051731_tabl !! (n-1)
    a051731_tabl = map (map a000007) a048158_tabl
    -- Reinhard Zumkeller, Aug 13 2013
    
  • Magma
    [0^(n mod k): k in [1..n], n in [1..17]]; // G. C. Greubel, Jun 22 2024
    
  • Maple
    A051731 := proc(n, k) if n mod k = 0 then 1 else 0 end if end proc:
    # R. J. Mathar, Jul 14 2012
  • Mathematica
    Flatten[Table[If[Mod[n, k] == 0, 1, 0], {n, 20}, {k, n}]]
  • PARI
    for(n=1,17,for(k=1,n,print1(!(n%k)", "))) \\ Charles R Greathouse IV, Mar 14 2012
    
  • Python
    from math import isqrt, comb
    def A051731(n): return int(not (a:=(m:=isqrt(k:=n<<1))+(k>m*(m+1)))%(n-comb(a,2))) # Chai Wah Wu, Nov 13 2024
  • Sage
    A051731_row = lambda n: [int(k.divides(n)) for k in (1..n)]
    for n in (1..17): print(A051731_row(n)) # Peter Luschny, Jan 05 2018
    

Formula

{T(n, k)*k, k=1..n} setminus {0} = divisors(n).
Sum_{k=1..n} T(n, k)*k^i = sigma[i](n), where sigma[i](n) is the sum of the i-th power of the positive divisors of n.
Sum_{k=1..n} T(n, k) = A000005(n).
Sum_{k=1..n} T(n, k)*k = A000203(n).
T(n, k) = T(n-k, k) for k <= n/2, T(n, k) = 0 for n/2 < k <= n-1, T(n, n) = 1.
Rows given by A074854 converted to binary. Example: A074854(4) = 13 = 1101_2; row 4 = 1, 1, 0, 1. - Philippe Deléham, Oct 04 2003
From Paul Barry, Dec 05 2004: (Start)
Binomial transform (product by binomial matrix) is A101508.
Columns have g.f.: x^k/(1-x^(k+1)) (k >= 0). (End)
Matrix inverse of triangle A054525, where A054525(n, k) = MoebiusMu(n/k) if k|n, 0 otherwise. - Paul D. Hanna, Jan 09 2006
From Gary W. Adamson, Apr 15 2007, May 10 2007: (Start)
Equals A129372 * A115361 as infinite lower triangular matrices.
A054525 is the inverse of this triangle (as lower triangular matrix).
This triangle * [1, 2, 3, ...] = sigma(n) (A000203).
This triangle * [1/1, 1/2, 1/3, ...] = sigma(n)/n. (End)
From Reinhard Zumkeller, Nov 01 2009: (Start)
T(n, k) = 0^(n mod k).
T(n, k) = A000007(A048158(n, k)). (End)
From Mats Granvik, Jan 26 2010, Feb 10 2010, Feb 16 2010: (Start)
T(n, k) = A172119(n) mod 2.
T(n, k) = A175105(n) mod 2.
T(n, k) = Sum_{i=1..k-1} (T(n-i, k-1) - T(n-i, k)) for k > 1 and T(n, 1) = 1.
(Jeffrey O. Shallit kindly provided a clarification along with a proof of this formula.) (End)
A049820(n) = number of zeros in n-th row. - Reinhard Zumkeller, Mar 09 2010
The determinant of this matrix where T(n, n) has been swapped with T(1,k) is equal to the n-th term of the Mobius function. - Mats Granvik, Jul 21 2012
T(n, k) = Sum_{y=1..n} Sum_{x=1..n} [GCD((x/y)*(k/n), n) = k]. - Mats Granvik, Dec 17 2023

Extensions

Edited by Peter Luschny, Oct 18 2023

A004125 Sum of remainders of n mod k, for k = 1, 2, 3, ..., n.

Original entry on oeis.org

0, 0, 1, 1, 4, 3, 8, 8, 12, 13, 22, 17, 28, 31, 36, 36, 51, 47, 64, 61, 70, 77, 98, 85, 103, 112, 125, 124, 151, 138, 167, 167, 184, 197, 218, 198, 233, 248, 269, 258, 297, 284, 325, 328, 339, 358, 403, 374, 414, 420, 449, 454, 505, 492, 529, 520, 553, 578, 635, 586, 645, 672
Offset: 1

Views

Author

Keywords

Comments

Row sums of A051778, A048158. Antidiagonal sums of A051127. - L. Edson Jeffery, Mar 03 2012
Let u_m(n) = Sum_{k=1..n} (n^m mod k^m) with m integer. As n-->+oo, u_m(n) ~ (n^(m+1))*(1-(1/(m+1))*Zeta(1+1/m)). Proof: using Riemann sums, we have u_m(n) ~ (n^(m+1))*int(((1/x)[nonascii character here])*(1-floor(x^m)/(x^m)),x=1..+oo) and the result follows. - Yalcin Aktar, Jul 30 2008 [x is the real variable of integration. The nonascii character (which was illegible in the original message) is probably some form of multiplication sign. I suggest that we leave it the way it is for now. - N. J. A. Sloane, Dec 07 2014]
Also the alternating row sums of A236112. - Omar E. Pol, Jan 26 2014
If n is prime then a(n) = a(n-1) + n - 2. - Omar E. Pol, Mar 19 2014
If n is a power of 2 greater than 1, then a(n) = a(n-1). - David Morales Marciel, Oct 21 2015
It appears that if n is an even perfect number, then a(n) = a(n-1) - 1. - Omar E. Pol, Oct 21 2015
Partial sums of A235796. - Omar E. Pol, Jun 26 2016
Aside from a(n) = a(n-1) for n = 2^m, the only values appearing more than once among the first 6*10^8 terms are those at n = 38184 +- 1, 458010 +- 1, 776112 +- 1, 65675408 +- 1, and 113393280 +- 2. - Trevor Cappallo, Jun 07 2021
The off-by-1 terms in the comment above are the terms of A068077. Proof: If a(n-1) = a(n+1), then (n-1)^2 - Sum_{k=1..n-1} sigma(k) = (n+1)^2 - Sum_{k=1..n+1} sigma(k) via the formula; rearranging terms gives sigma(n)+sigma(n+1)=4n. - Lewis Chen, Sep 24 2021

Examples

			a(5) = 4. The remainder when 5 is divided by 2,3,4 respectively is 1,2,1 and their sum = 4.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000290, A006218, A023196, A048158, A050482, A051778, A120444 (first differences).

Programs

  • GAP
    List([1..70],n->n^2-Sum([1..n],k->Sigma(k))); # Muniru A Asiru, Mar 28 2018
    
  • Haskell
    a004125 n = sum $ map (mod n) [1..n]
    -- Reinhard Zumkeller, Jan 28 2011
    
  • Magma
    [&+[n mod r: r in [1..n]]: n in [1..70]]; // Bruno Berselli, Jul 06 2014
    
  • Maple
    A004125 := n -> add( modp(n,k), k=2..n); /* much faster and unambiguous; "a mod b" may be mods(a,b) */ # M. F. Hasler, Nov 22 2007
  • Mathematica
    Table[Sum[Mod[n,k],{k,2,n-1}],{n,70}] (* Harvey P. Dale, Nov 23 2011 *)
    Accumulate[Table[2n-1-DivisorSigma[1,n],{n,70}]] (* Harvey P. Dale, Jul 11 2014 *)
  • PARI
    A004125(n)=sum(k=2,n,n%k) \\ M. F. Hasler, Nov 22 2007
    
  • Python
    def a(n): return sum(n%k for k in range(1, n))
    print([a(n) for n in range(1, 63)]) # Michael S. Branicky, Jun 08 2021
    
  • Python
    from math import isqrt
    def A004125(n): return n**2+((s:=isqrt(n))**2*(s+1)-sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1))>>1) # Chai Wah Wu, Oct 21 2023
    
  • SageMath
    def a(n): return sum(n.mod(k) for k in (1..n))
    print([a(n) for n in (1..62)])  # Peter Luschny, May 12 2025

Formula

a(n) = n^2 - Sum_{k=1..n} sigma(k) = A000290(n) - A024916(n), hence asymptotically a(n) = n^2*(1-Pi^2/12) + O(n*log(n)^(2/3)). - Benoit Cloitre, Apr 28 2002. Asymptotics corrected/improved by Charles R Greathouse IV, Feb 22 2015
a(n) = A008805(n-3) + A049798(n-1), for n > 2. - Carl Najafi, Jan 31 2013
a(n) = A000217(n-1) - A153485(n). - Omar E. Pol, Jan 28 2014
G.f.: x^2/(1-x)^3 - (1-x)^(-1) * Sum_{k>=1} k*x^(2*k)/(1-x^k). - Robert Israel, Aug 13 2015
a(n) = Sum_{i=1..n} (n mod i). - Wesley Ivan Hurt, Sep 15 2017
From Ridouane Oudra, May 12 2025: (Start)
a(n) = A067439(n) + A072514(n).
a(n) = Sum_{d|n} d*A067439(n/d).
a(p) = A067439(p), for p prime.
a(p^k) = A072514(p^(k+1))/p, for p prime and k >= 0. (End)
a(n) = A111490(n) - n. - Peter Luschny, May 12 2025

Extensions

Edited by M. F. Hasler, Apr 18 2015

A010766 Triangle read by rows: row n gives the numbers floor(n/k), k = 1..n.

Original entry on oeis.org

1, 2, 1, 3, 1, 1, 4, 2, 1, 1, 5, 2, 1, 1, 1, 6, 3, 2, 1, 1, 1, 7, 3, 2, 1, 1, 1, 1, 8, 4, 2, 2, 1, 1, 1, 1, 9, 4, 3, 2, 1, 1, 1, 1, 1, 10, 5, 3, 2, 2, 1, 1, 1, 1, 1, 11, 5, 3, 2, 2, 1, 1, 1, 1, 1, 1, 12, 6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1, 13, 6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Keywords

Comments

Number of times k occurs as divisor of numbers not greater than n. - Reinhard Zumkeller, Mar 19 2004
Viewed as a partition, row n is the smallest partition that contains every partition of n in the usual ordering. - Franklin T. Adams-Watters, Mar 11 2006
Row sums = A006218. - Gary W. Adamson, Oct 30 2007
A014668 = eigensequence of the triangle. A163313 = A010766 * A014668 (diagonalized) as an infinite lower triangular matrix. - Gary W. Adamson, Jul 30 2009
A018805(T(n,k)) = A242114(n,k). - Reinhard Zumkeller, May 04 2014
Viewed as partitions, all rows are self-conjugate. - Matthew Vandermast, Sep 10 2014
Row n is the partition whose Young diagram is the union of Young diagrams of all partitions of n (rewording of Franklin T. Adams-Watters's comment). - Harry Richman, Jan 13 2022

Examples

			Triangle starts:
   1:  1;
   2:  2,  1;
   3:  3,  1, 1;
   4:  4,  2, 1, 1;
   5:  5,  2, 1, 1, 1;
   6:  6,  3, 2, 1, 1, 1;
   7:  7,  3, 2, 1, 1, 1, 1;
   8:  8,  4, 2, 2, 1, 1, 1, 1;
   9:  9,  4, 3, 2, 1, 1, 1, 1, 1;
  10: 10,  5, 3, 2, 2, 1, 1, 1, 1, 1;
  11: 11,  5, 3, 2, 2, 1, 1, 1, 1, 1, 1;
  12: 12,  6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1;
  13: 13,  6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1;
  14: 14,  7, 4, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1;
  15: 15,  7, 5, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1;
  16: 16,  8, 5, 4, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1;
  17: 17,  8, 5, 4, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1;
  18: 18,  9, 6, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1;
  19: 19,  9, 6, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1;
  20: 20, 10, 6, 5, 4, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1;
  ...
		

References

  • Florian Cajori, A History of Mathematical Notations, Dover edition (2012), par. 407.

Crossrefs

Another version of A003988.
Finite differences of rows: A075993.
Cf. related triangles: A002260, A013942, A051731, A163313, A277646, A277647.
Cf. related sequences: A006218, A014668, A115725.
Columns of this triangle:
T(n,1) = n,
T(n,2) = A008619(n-2) for n>1,
T(n,3) = A008620(n-3) for n>2,
T(n,4) = A008621(n-4) for n>3,
T(n,5) = A002266(n) for n>4,
T(n,n) = A000012(n) = 1.
Rows of this triangle (with infinite trailing zeros):
T(1,k) = A000007(k-1),
T(2,k) = A033322(k),
T(3,k) = A278105(k),
T(4,k) = A033324(k),
T(5,k) = A033325(k),
T(6,k) = A033326(k),
T(7,k) = A033327(k),
T(8,k) = A033328(k),
T(9,k) = A033329(k),
T(10,k) = A033330(k),
...
T(99,k) = A033419(k),
T(100,k) = A033420(k),
T(1000,k) = A033421(k),
T(10^4,k) = A033422(k),
T(10^5,k) = A033427(k),
T(10^6,k) = A033426(k),
T(10^7,k) = A033425(k),
T(10^8,k) = A033424(k),
T(10^9,k) = A033423(k).

Programs

  • Haskell
    a010766 = div
    a010766_row n = a010766_tabl !! (n-1)
    a010766_tabl = zipWith (map . div) [1..] a002260_tabl
    -- Reinhard Zumkeller, Apr 29 2015, Aug 13 2013, Apr 13 2012
    
  • Maple
    seq(seq(floor(n/k),k=1..n),n=1..20); # Robert Israel, Sep 01 2014
  • Mathematica
    Flatten[Table[Floor[n/k],{n,20},{k,n}]] (* Harvey P. Dale, Nov 03 2012 *)
  • PARI
    a(n)=t=floor((-1+sqrt(1+8*(n-1)))/2);(t+1)\(n-t*(t+1)/2) \\ Edward Jiang, Sep 10 2014
    
  • PARI
    T(n, k) = sum(i=1, n, (i % k) == 0); \\ Michel Marcus, Apr 08 2017

Formula

G.f.: 1/(1-x)*Sum_{k>=1} x^k/(1-y*x^k). - Vladeta Jovovic, Feb 05 2004
Triangle A010766 = A000012 * A051731 as infinite lower triangular matrices. - Gary W. Adamson, Oct 30 2007
Equals A000012 * A051731 as infinite lower triangular matrices. - Gary W. Adamson, Nov 14 2007
Let T(n,0) = n+1, then T(n,k) = (sum of the k preceding elements in the previous column) minus (sum of the k preceding elements in same column). - Mats Granvik, Gary W. Adamson, Feb 20 2010
T(n,k) = (n - A048158(n,k)) / k. - Reinhard Zumkeller, Aug 13 2013
T(n,k) = 1 + T(n-k,k) (where T(n-k,k) = 0 if n < 2*k). - Robert Israel, Sep 01 2014
T(n,k) = T(floor(n/k),1) if k>1; T(n,1) = 1 - Sum_{i=2..n} A008683(i)*T(n,i). If we modify the formula to T(n,1) = 1 - Sum_{i=2..n} A008683(i)*T(n,i)/i^s, where s is a complex variable, then the first column becomes the partial sums of the Riemann zeta function. - Mats Granvik, Apr 27 2016

Extensions

Cross references edited by Jason Kimberley, Nov 23 2016

A051127 Table T(n,k) = k mod n read by antidiagonals (n >= 1, k >= 1).

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 0, 1, 2, 1, 0, 0, 0, 2, 1, 0, 1, 1, 3, 2, 1, 0, 0, 2, 0, 3, 2, 1, 0, 1, 0, 1, 4, 3, 2, 1, 0, 0, 1, 2, 0, 4, 3, 2, 1, 0, 1, 2, 3, 1, 5, 4, 3, 2, 1, 0, 0, 0, 0, 2, 0, 5, 4, 3, 2, 1, 0, 1, 1, 1, 3, 1, 6, 5, 4, 3, 2, 1, 0, 0, 2, 2, 4, 2, 0, 6, 5, 4, 3, 2, 1, 0, 1, 0, 3, 0, 3, 1, 7, 6, 5, 4, 3, 2, 1
Offset: 1

Views

Author

Keywords

Comments

Note that the upper right half of this sequence when formatted as a square array is essentially the same as this whole sequence when formatted as an upper right triangle. Sums of antidiagonals are A004125. - Henry Bottomley, Jun 22 2001

Examples

			0  0  0  0  0  0  0  0  0  0 ...
1  0  1  0  1  0  1  0  1  0 ...
1  2  0  1  2  0  1  2  0  1 ...
1  2  3  0  1  2  3  0  1  2 ...
1  2  3  4  0  1  2  3  4  0 ...
1  2  3  4  5  0  1  2  3  4 ...
1  2  3  4  5  6  0  1  2  3 ...
1  2  3  4  5  6  7  0  1  2 ...
1  2  3  4  5  6  7  8  0  1 ...
1  2  3  4  5  6  7  8  9  0 ...
1  2  3  4  5  6  7  8  9 10 ...
1  2  3  4  5  6  7  8  9 10 ...
1  2  3  4  5  6  7  8  9 10 ...
		

Crossrefs

Transpose of A051126.

Programs

  • Mathematica
    T[n_, m_] = Mod[n - m + 1, m + 1]; Table[Table[T[n, m], {m, 0, n}], {n, 0, 10}]; Flatten[%] (* Roger L. Bagula, Sep 04 2008 *)
  • PARI
    T(n, k)=k%n \\ Charles R Greathouse IV, Feb 09 2017

Formula

As a linear array, the sequence is a(n) = A004736(n) mod A002260(n) or a(n) = ((t*t+3*t+4)/2-n) mod (n-(t*(t+1)/2)), where t = floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 17 2012
G.f. for the n-th row: y*Sum_{i=0..n-2} (i + 1)*y^i/(1 - y^n). - Stefano Spezia, May 08 2024

Extensions

More terms from James Sellers, Dec 11 1999

A051126 Table T(n,k) = n mod k read by downward antidiagonals (n >= 1, k >= 1).

Original entry on oeis.org

0, 1, 0, 1, 0, 0, 1, 2, 1, 0, 1, 2, 0, 0, 0, 1, 2, 3, 1, 1, 0, 1, 2, 3, 0, 2, 0, 0, 1, 2, 3, 4, 1, 0, 1, 0, 1, 2, 3, 4, 0, 2, 1, 0, 0, 1, 2, 3, 4, 5, 1, 3, 2, 1, 0, 1, 2, 3, 4, 5, 0, 2, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 1, 3, 1, 1, 1, 0, 1, 2, 3, 4, 5, 6, 0, 2, 4, 2, 2, 0, 0, 1, 2, 3, 4, 5, 6, 7, 1, 3, 0, 3, 0, 1, 0
Offset: 1

Views

Author

Keywords

Examples

			Table begins in row n=1:
  0  1  1  1  1  1  1  1  1  1 ...
  0  0  2  2  2  2  2  2  2  2 ...
  0  1  0  3  3  3  3  3  3  3 ...
  0  0  1  0  4  4  4  4  4  4 ...
  0  1  2  1  0  5  5  5  5  5 ...
  0  0  0  2  1  0  6  6  6  6 ...
  0  1  1  3  2  1  0  7  7  7 ...
  0  0  2  0  3  2  1  0  8  8 ...
  0  1  0  1  4  3  2  1  0  9 ...
  0  0  1  2  0  4  3  2  1  0 ...
  0  1  2  3  1  5  4  3  2  1 ...
  0  0  0  0  2  0  5  4  3  2 ...
  0  1  1  1  3  1  6  5  4  3 ...
		

Crossrefs

Programs

  • Mathematica
    TableForm[Table[Mod[n, k], {n, 1, 16}, {k, 1, 16}]] (* A051126 array *)
    Table[Mod[n - k + 1, k], {n, 16}, {k, n, 1, -1}] // Flatten  (* A051126 sequence *)
    (* Clark Kimberling, Feb 04 2016 *)

Formula

As a linear array, the sequence is a(n) = A002260(n) mod A004736 (n) or a(n) = (n-(t*(t+1)/2)) mod ((t*t+3*t+4)/2-n), where t = floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 19 2012
G.f. of the k-th column: x*Sum_{i=0..k-2} (i + 1)*x^i/(1 - x^k). - Stefano Spezia, May 08 2024

Extensions

More terms from James Sellers, Dec 11 1999

A234575 Triangle T(n, k) read by rows: T(n, k) = floor(n/k) + n mod k.

Original entry on oeis.org

1, 2, 1, 3, 2, 1, 4, 2, 2, 1, 5, 3, 3, 2, 1, 6, 3, 2, 3, 2, 1, 7, 4, 3, 4, 3, 2, 1, 8, 4, 4, 2, 4, 3, 2, 1, 9, 5, 3, 3, 5, 4, 3, 2, 1, 10, 5, 4, 4, 2, 5, 4, 3, 2, 1, 11, 6, 5, 5, 3, 6, 5, 4, 3, 2, 1, 12, 6, 4, 3, 4, 2, 6, 5, 4, 3, 2, 1, 13, 7, 5, 4, 5, 3, 7, 6, 5
Offset: 1

Views

Author

Alex Ratushnyak, Dec 28 2013

Keywords

Examples

			Triangle begins:
   1
   2  1
   3  2  1
   4  2  2  1
   5  3  3  2  1
   6  3  2  3  2  1
   7  4  3  4  3  2  1
   8  4  4  2  4  3  2  1
   9  5  3  3  5  4  3  2  1
  10  5  4  4  2  5  4  3  2  1
  11  6  5  5  3  6  5  4  3  2  1
  12  6  4  3  4  2  6  5  4  3  2  1
  13  7  5  4  5  3  7  6  5  4  3  2  1
  14  7  6  5  6  4  2  7  6  5  4  3  2  1
  15  8  5  6  3  5  3  8  7  6  5  4  3  2  1
		

Crossrefs

Programs

  • Haskell
    a234575 n k = a234575_tabl !! (n-1) !! (k-1)
    a234575_row n = a234575_tabl !! (n-1)
    a234575_tabl = zipWith (zipWith (+)) a048158_tabl a010766_tabl
    -- Reinhard Zumkeller, Apr 29 2015
  • Mathematica
    With[{rows=10},Table[Floor[n/k]+Mod[n,k],{n,rows},{k,n}]] (* Paolo Xausa, Sep 26 2023 *)
  • Python
    for n in range(1, 19):
      for k in range(1, n+1):
        c = n//k + n%k
        print('%2d' % c, end=' ')
      print()
    
  • Python
    def T(n, k) -> int: return n - (k - 1) * (n // k)
    for n in range(1,16): print([T(n, k) for k in range(1,n+1)]) # Peter Luschny, Jun 01 2025
    
  • Scheme
    ;; MIT/GNU Scheme
    (define (A234575bi n k) (+ (floor->exact (/ n k)) (modulo n k)))
    (define (A234575 n) (A234575bi (A002024 n) (A002260 n)))
    ;; Antti Karttunen, Dec 29 2013
    

Formula

T(n, k) = A048158(n, k) + A010766(n, k). - Reinhard Zumkeller, Apr 29 2015
G.f. of the k-th column: x^k*((Sum_{i=0..k-1} x^i) - (k-1)*x^k)/((1 - x)^2*Sum_{i=0..k-1} x^i). - Stefano Spezia, May 08 2024
T(n, k) = n - (k - 1) * floor(n/k). - Peter Luschny, Jun 01 2025

A051777 Triangle read by rows, where row (n) = n mod n, n mod (n-1), n mod (n-2), ...n mod 1.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 2, 1, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 3, 1, 1, 0, 0, 1, 2, 3, 0, 2, 0, 0, 0, 1, 2, 3, 4, 1, 0, 1, 0, 0, 1, 2, 3, 4, 0, 2, 1, 0, 0, 0, 1, 2, 3, 4, 5, 1, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 0, 2, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 1, 3, 1, 1, 1, 0, 0, 1, 2, 3, 4, 5, 6, 0, 2, 4, 2, 2, 0, 0
Offset: 1

Views

Author

Asher Auel, Dec 09 1999

Keywords

Comments

Also, rectangular array read by antidiagonals, a(n, k) = k mod n (k >= 0, n >= 1). Cf. A048158, A051127. - David Wasserman, Oct 01 2008
Central terms: a(2*n - 1, n) = n - 1. - Reinhard Zumkeller, Jan 25 2011

Examples

			row (5) = 5 mod 5, 5 mod 4, 5 mod 3, 5 mod 2, 5 mod 1 = 0, 1, 2, 1, 0.
0 ;
0  0 ;
0  1  0 ;
0  1  0  0 ;
0  1  2  1  0;
0  1  2  0  0  0 ;
0  1  2  3  1  1  0 ;
0  1  2  3  0  2  0  0;
0  1  2  3  4  1  0  1  0 ;
0  1  2  3  4  0  2  1  0  0 ;
0  1  2  3  4  5  1  3  2  1  0 ;
0  1  2  3  4  5  0  2  0  0  0  0 ;
0  1  2  3  4  5  6  1  3  1  1  1  0 ;
		

Crossrefs

Cf. A051778. Row sums give A004125. Number of 0's in row n gives A000005 (tau(n)). Number of 1's in row n+1 gives A032741(n).

Programs

  • Haskell
    a051777 n k = a051777_row n !! (k-1)
    a051777_row n = map (mod n) [n, n-1 .. 1]
    a051777_tabl = map a051777_row [1..]
    -- Reinhard Zumkeller, Jan 25 2011
  • Mathematica
    Flatten[Table[Mod[n,Range[n,1,-1]],{n,20}]] (* Harvey P. Dale, Nov 30 2011 *)

A062169 Triangle T(n, k) = k! mod n for n >= 1, 1 <= k <= n.

Original entry on oeis.org

0, 1, 0, 1, 2, 0, 1, 2, 2, 0, 1, 2, 1, 4, 0, 1, 2, 0, 0, 0, 0, 1, 2, 6, 3, 1, 6, 0, 1, 2, 6, 0, 0, 0, 0, 0, 1, 2, 6, 6, 3, 0, 0, 0, 0, 1, 2, 6, 4, 0, 0, 0, 0, 0, 0, 1, 2, 6, 2, 10, 5, 2, 5, 1, 10, 0, 1, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 6, 11, 3, 5, 9, 7, 11, 6, 1, 12, 0, 1, 2, 6, 10, 8, 6, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Henry Bottomley, Jun 11 2001

Keywords

Examples

			a(7,4) = 4! mod 7 = 24 mod 7 = 3. Rows are:
0;
1,0;
1,2,0;
1,2,2,0;
1,2,1,4,0;
1,2,0,0,0,0;
1,2,6,3,1,6,0;
1,2,6,0,0,0,0,0;
1,2,6,6,3,0,0,0,0;
1,2,6,4,0,0,0,0,0,0;
		

Crossrefs

First zero in each row is when k=A002034. Maximum value in each row is A062170. Number of distinct values in each row is A038203. Cf. A000142, A048158, A051127.

Programs

  • Mathematica
    Table[Mod[Range[n]!, n], {n, 1, 15}] // Flatten (* Jean-François Alcover, Oct 25 2013 *)
  • PARI
    { n=0; for (k=1, 50, for (m=1, k, write("b062169.txt", n++, " ", m!%k)) ) } \\ Harry J. Smith, Aug 02 2009

Extensions

Definition amended by Georg Fischer, Oct 27 2021
Showing 1-10 of 22 results. Next