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-3 of 3 results.

A004736 Triangle read by rows: row n lists the first n positive integers in decreasing order.

Original entry on oeis.org

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

Views

Author

R. Muller

Keywords

Comments

Old name: Triangle T(n,k) = n-k, n >= 1, 0 <= k < n. Fractal sequence formed by repeatedly appending strings m, m-1, ..., 2, 1.
The PARI functions t1 (this sequence), t2 (A002260) can be used to read a square array T(n,k) (n >= 1, k >= 1) by antidiagonals upwards: n -> T(t1(n), t2(n)). - Michael Somos, Aug 23 2002, edited by M. F. Hasler, Mar 31 2020
A004736 is the mirror of the self-fission of the polynomial sequence (q(n,x)) given by q(n,x) = x^n+ x^(n-1) + ... + x + 1. See A193842 for the definition of fission. - Clark Kimberling, Aug 07 2011
Seen as flattened list: a(A000217(n)) = 1; a(A000124(n)) = n and a(m) <> n for m < A000124(n). - Reinhard Zumkeller, Jul 22 2012
Sequence B is called a reverse reluctant sequence of sequence A, if B is triangle array read by rows: row number k lists first k elements of the sequence A in reverse order. Sequence A004736 is the reverse reluctant sequence of sequence 1,2,3,... (A000027). - Boris Putievskiy, Dec 13 2012
The row sums equal A000217(n). The alternating row sums equal A004526(n+1). The antidiagonal sums equal A002620(n+1) respectively A008805(n-1). - Johannes W. Meijer, Sep 28 2013
From Peter Bala, Jul 29 2014: (Start)
Riordan array (1/(1-x)^2,x). Call this array M and for k = 0,1,2,... define M(k) to be the lower unit triangular block array
/I_k 0\
\ 0 M/
having the k X k identity matrix I_k as the upper left block; in particular, M(0) = M. Then the infinite matrix product M(0)*M(1)*M(2)*... is equal to A078812. (End)
T(n, k) gives the number of subsets of [n] := {1, 2, ..., n} with k consecutive numbers (consecutive k-subsets of [n]). - Wolfdieter Lang, May 30 2018
a(n) gives the distance from (n-1) to the smallest triangular number > (n-1). - Ctibor O. Zizka, Apr 09 2020
To construct the sequence, start from 1,2,,3,,,4,,,,5,,,,,6... where there are n commas after each "n". Then fill the empty places by the sequence itself. - Benoit Cloitre, Aug 17 2021
T(n,k) is the number of cycles of length 2*(k+1) in the (n+1)-ladder graph. There are no cycles of odd length. - Mohammed Yaseen, Jan 14 2023
The first 77 entries are also the signature sequence of log(3)=A002391. Then the two sequences start to differ. - R. J. Mathar, May 27 2024

Examples

			The triangle T(n, k) starts:
   n\k  1  2  3  4  5  6  7  8  9 10 11 12 ...
   1:   1
   2:   2  1
   3:   3  2  1
   4:   4  3  2  1
   5:   5  4  3  2  1
   6:   6  5  4  3  2  1
   7:   7  6  5  4  3  2  1
   8:   8  7  6  5  4  3  2  1
   9:   9  8  7  6  5  4  3  2  1
  10:  10  9  8  7  6  5  4  3  2  1
  11:  11 10  9  8  7  6  5  4  3  2  1
  12:  12 11 10  9  8  7  6  5  4  3  2  1
  ... Reformatted. - _Wolfdieter Lang_, Feb 04 2015
T(6, 3) = 4 because the four consecutive 3-subsets of [6] = {1, 2, ..., 6} are {1, 2, 3}, {2, 3, 4}, {3, 4, 5} and {4, 5, 6}. - _Wolfdieter Lang_, May 30 2018
		

References

  • H. S. M. Coxeter, Regular Polytopes, 3rd ed., Dover, NY, 1973, pp 159-162.

Crossrefs

Ordinal transform of A002260. See also A078812.
Cf. A141419 (partial sums per row).
Cf. A134546 (T * A051731, matrix product).
See A001511 for definition of ordinal transform.
Cf. A128174 (parity).

Programs

  • Excel
    =if(row()>=column();row()-column()+1;"") [Mats Granvik, Jan 19 2009]
    
  • Haskell
    a004736 n k = n - k + 1
    a004736_row n = a004736_tabl !! (n-1)
    a004736_tabl = map reverse a002260_tabl
    -- Reinhard Zumkeller, Aug 04 2014, Jul 22 2012
    
  • Maple
    A004736 := proc(n,m) n-m+1 ; end:
    T := (n, k) -> n-k+1: seq(seq(T(n,k), k=1..n), n=1..13); # Johannes W. Meijer, Sep 28 2013
  • Mathematica
    Flatten[ Table[ Reverse[ Range[n]], {n, 12}]] (* Robert G. Wilson v, Apr 27 2004 *)
    Table[Range[n,1,-1],{n,20}]//Flatten (* Harvey P. Dale, May 27 2020 *)
  • PARI
    {a(n) = 1 + binomial(1 + floor(1/2 + sqrt(2*n)), 2) - n}
    
  • PARI
    {t1(n) = binomial( floor(3/2 + sqrt(2*n)), 2) - n + 1} /* A004736 */
    
  • PARI
    {t2(n) = n - binomial( floor(1/2 + sqrt(2*n)), 2)} /* A002260 */
    
  • PARI
    apply( A004736(n)=1-n+(n=sqrtint(8*n)\/2)*(n+1)\2, [1..99]) \\ M. F. Hasler, Mar 31 2020
    
  • Python
    def agen(rows):
        for n in range(1, rows+1): yield from range(n, 0, -1)
    print([an for an in agen(13)]) # Michael S. Branicky, Aug 17 2021
    
  • Python
    from math import comb, isqrt
    def A004736(n): return comb((m:=isqrt(k:=n<<1))+(k>m*(m+1))+1,2)+1-n # Chai Wah Wu, Nov 08 2024

Formula

a(n+1) = 1 + A025581(n).
a(n) = (2 - 2*n + round(sqrt(2*n)) + round(sqrt(2*n))^2)/2. - Brian Tenneson, Oct 11 2003
G.f.: 1 / ((1-x)^2 * (1-x*y)). - Ralf Stephan, Jan 23 2005
Recursion: e(n,k) = (e(n - 1, k)*e(n, k - 1) + 1)/e(n - 1, k - 1). - Roger L. Bagula, Mar 25 2009
a(n) = (t*t+3*t+4)/2-n, where t = floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 13 2012
From Johannes W. Meijer, Sep 28 2013: (Start)
T(n, k) = n - k + 1, n >= 1 and 1 <= k <= n.
T(n, k) = A002260(n+k-1, n-k+1). (End)
a(n) = A000217(A002024(n)) - n + 1. - Enrique Pérez Herrero, Aug 29 2016

Extensions

New name from Omar E. Pol, Jul 15 2012

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

A078567 Number of arithmetic subsequences of [1..n] with length > 1.

Original entry on oeis.org

0, 1, 4, 9, 17, 27, 41, 57, 77, 100, 127, 156, 191, 228, 269, 314, 364, 416, 474, 534, 600, 670, 744, 820, 904, 991, 1082, 1177, 1278, 1381, 1492, 1605, 1724, 1847, 1974, 2105, 2245, 2387, 2533, 2683, 2841, 3001, 3169, 3339, 3515, 3697, 3883, 4071, 4269, 4470
Offset: 1

Views

Author

Robert E. Sawyer (rs.1(AT)mindspring.com)

Keywords

Comments

The number of arithmetic subsequences of [1..n] with successive-term increment i and length k is n-i*(k-1) for i > 0, k > 0, n > i*(k-1).
Appears to be the partial sums of A006218. - N. J. A. Sloane, Nov 24 2008
The O(n^(1/2)) formula can be derived via Dirichlet hyperbola method (see Wikipedia link below) applied to a(n) = Sum_{k=1..n-1} Sum_{i*j=k} (sqrt(n)*sqrt(n)-i*j), where we've written the formula in this form to show which functions are being Dirichlet convoluted. - Daniel Hoying, May 31 2020
Apart from initial zero this is the convolution of A341062 and the nonzero terms of A000217. - Omar E. Pol, Feb 16 2021

Examples

			a(2): [1,2]; a(3): [1,2],[1,3],[2,3],[1,2,3].
		

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n<1, [0$2],
          (p-> p+[numtheory[tau](n), p[1]])(b(n-1)))
        end:
    a:= n-> b(n)[2]:
    seq(a(n), n=1..55);  # Alois P. Heinz, Oct 07 2021
  • Mathematica
    a[n_]:=-(-1 + n) n + Sum[-(1/2) Ceiling[n/(1 + k)] (-1 - k - 2 n + (1 + k) Ceiling[n/(1 + k)]), {k, 0, n - 2}]; (* Lorenz H. Menke, Jr., Feb 17 2017 *)
    Table[Sum[(n - i) DivisorSigma[0, i], {i, n}], {n, 47}] (* or *)
    With[{nn = 46}, {0}~Join~Table[First[ListConvolve @@ Transpose@ Take[#, n]], {n, nn}] &@ Table[{n, DivisorSigma[0, n]}, {n, nn}]] (* Michael De Vlieger, Feb 18 2017 *)
  • PARI
    a(n)=sum(i=1,n, numdiv(i)*(n-i)) \\ Charles R Greathouse IV, Feb 18 2017
    
  • PARI
    a(n)={n--; sqrtint(n)^2*(1/4 * (1+sqrtint(n))^2-n-1) + sum(i=1, sqrtint(n), (n\i)*(2*n + 2 - i*(1+n\i)))} \\ Andrew Howroyd, May 31 2020
    
  • Python
    from math import isqrt
    def A078567(n):
        m = isqrt(n-1)
        return m**2*(1+m)**2//4-m**2*n+sum((n-1)//i*(2*n-i*(1+(n-1)//i)) for i in range(1,m+1)) # Chai Wah Wu, Oct 07 2021

Formula

a(n) = Sum_{i=1..n-1} Sum_{j=1..floor((n-1)/i)} (n - i*j).
Convolution of A000027 and A000005. - Vladeta Jovovic, Apr 08 2006
Row sums of triangle A134546. - Gary W. Adamson, Oct 31 2007
a(n) = Sum_{i=1..n} (n-i) * A000005(i). - Wesley Ivan Hurt, May 08 2016
G.f.: (x/(1 - x)^2)*Sum_{k>=1} x^k/(1 - x^k). - Ilya Gutkovskiy, Jan 02 2017
a(n) = Sum_{k=1..n-1} Sum_{i=1..n-1} floor(k/i). - Wesley Ivan Hurt, Sep 14 2017
a(n) = Sum_{k=1..n-1} Sum_{i|k} (n-k). - Daniel Hoying, May 26 2020
a(n+1) = floor(sqrt(n))^2*(1/4*(1+floor(sqrt(n)))^2 - n - 1) + Sum_{i=1..floor(sqrt(n))} floor(n/i)*(2*n + 2 - i*(1+floor(n/i))). - Daniel Hoying, May 31 2020
Showing 1-3 of 3 results.