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

A032741 a(0) = 0; for n > 0, a(n) = number of proper divisors of n (divisors of n which are less than n).

Original entry on oeis.org

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

Views

Author

Patrick De Geest, May 15 1998

Keywords

Comments

Number of d < n which divide n.
Call an integer k between 1 and n a "semi-divisor" of n if n leaves a remainder of 1 when divided by k, i.e., n == 1 (mod k). a(n) gives the number of semi-divisors of n+1. - Joseph L. Pe, Sep 11 2002
a(n+1) is also the number of k, 0 <= k <= n-1, such that C(n,k) divides C(n,k+1). - Benoit Cloitre, Oct 17 2002
a(n+1) is also the number of factors of the n-th degree polynomial x^n + x^(n-1) + x^(n-2) + ... + x^2 + x + 1. Example: 1 + x + x^2 + x^3 = (1+x)(1+x^2) implies a(4)=2.
a(n) is also the number of factors of the n-th Fibonacci polynomial. - T. D. Noe, Mar 09 2006
Number of partitions of n into 2 parts with the second dividing the first. - Franklin T. Adams-Watters, Sep 20 2006
Number of partitions of n+1 into exactly one q and at least one q+1. Example: a(12)=5; indeed, we have 13 = 7 + 6 = 5 + 4 + 4 = 4 + 3 + 3 + 3 = 3 + 2 + 2 + 2 + 2 + 2 = 2 + 11*1.
Differences of A002541. - George Beck, Feb 12 2012
For n > 1: number of ones in row n+1 of triangle A051778. - Reinhard Zumkeller, Dec 03 2014
For n > 0, a(n) is the number of strong divisors of n. - Omar E. Pol, May 03 2015
a(n) is also the number of factors of the (n-1)-th degree polynomial ((x+1)^n-1)/x. Example: for n=6, ((x+1)^6-1)/x = x^5 + 6*x^4 + 15*x^3 + 20*x^2 + 15*x + 6 = (2+x)(1+x+x^2)(3+3x+x^2) implies a(6)=3. - Federico Provvedi, Oct 09 2018
Consider the polynomial P(n,z) = Sum_{i=1..q} d(i)*z^(i-1) where d(1), d(2), ..., d(q) are are the q ordered divisors of n. The sequence lists the numbers of zeros of P(n,z) strictly inside the unit circle. - Michel Lagneau, Apr 06 2025

Examples

			a(6) = 3 since the proper divisors of 6 are 1, 2, 3.
		

References

  • André Weil, Number Theory, An approach through history, From Hammurapi to Legendre, Birkhäuser, 1984, page 5.

Crossrefs

Column 2 of A122934.
Cf. A003238, A001065, A027749, A027751 (list of proper divisors).

Programs

  • GAP
    Concatenation([0],List([1..100],n->Tau(n)-1)); # Muniru A Asiru, Oct 09 2018
    
  • Haskell
    a032741 n = if n == 0 then 0 else a000005 n - 1
    -- Reinhard Zumkeller, Jul 31 2014
    
  • Maple
    A032741 := proc(n)
        if n = 0 then
            0 ;
        else
            numtheory[tau](n)-1 ;
        end if;
    end proc: # R. J. Mathar, Feb 03 2013
  • Mathematica
    Prepend[DivisorSigma[0, Range[99]]-1, 0] (* Jayanta Basu, May 25 2013 *)
  • PARI
    a(n) = if(n<1,0,numdiv(n)-1)
    
  • PARI
    {a(n)=polcoeff(2*sum(m=1,n\2+1,sumdiv(m,d,log(1-x^(m/d) +x*O(x^n) )^(2*d)/(2*d)!)), n)} \\ Paul D. Hanna, Aug 21 2014
    
  • Python
    from sympy import divisor_count
    def A032741(n): return divisor_count(n)-1 if n else 0 # Chai Wah Wu, Mar 14 2023

Formula

a(n) = tau(n)-1 = A000005(n)-1. Cf. A039653.
G.f.: Sum_{n>=1} x^(2*n)/(1-x^n). - Michael Somos, Apr 29 2003
G.f.: Sum_{i>=1} (1-x^i+x^(2*i))/(1-x^i). - Jon Perry, Jul 03 2004
a(n) = Sum_{k=1..floor(n/2)} A051731(n-k,k). - Reinhard Zumkeller, Nov 01 2009
G.f.: 2*Sum_{n>=1} Sum_{d|n} log(1 - x^(n/d))^(2*d) / (2*d)!. - Paul D. Hanna, Aug 21 2014
Dirichlet g.f.: zeta(s)*(zeta(s)-1). - Geoffrey Critzer, Dec 06 2014
a(n) = Sum_{k=1..n-1} binomial((n-1) mod k, k-1). - Wesley Ivan Hurt, Sep 26 2016
a(n) = Sum_{i=1..n-1} floor(n/i)-floor((n-1)/i). - Wesley Ivan Hurt, Nov 15 2017
a(n) = Sum_{i=1..n-1} 1-sign(i mod (n-i)). - Wesley Ivan Hurt, Sep 27 2018
Sum_{k=1..n} a(k) ~ n*log(n) + 2*(gamma - 1)*n, where gamma is Euler's constant (A001620). - Amiram Eldar, Nov 27 2022

Extensions

Typos in definition corrected by Omar E. Pol, Dec 13 2008

A049820 a(n) = n - d(n), where d(n) is the number of divisors of n (A000005).

Original entry on oeis.org

0, 0, 1, 1, 3, 2, 5, 4, 6, 6, 9, 6, 11, 10, 11, 11, 15, 12, 17, 14, 17, 18, 21, 16, 22, 22, 23, 22, 27, 22, 29, 26, 29, 30, 31, 27, 35, 34, 35, 32, 39, 34, 41, 38, 39, 42, 45, 38, 46, 44, 47, 46, 51, 46, 51, 48, 53, 54, 57, 48, 59, 58, 57, 57, 61, 58, 65
Offset: 1

Views

Author

Keywords

Comments

a(n) is the number of non-divisors of n in 1..n. - Jaroslav Krizek, Nov 14 2009
Also equal to the number of partitions p of n such that max(p)-min(p) = 1. The number of partitions of n with max(p)-min(p) <= 1 is n; there is one with k parts for each 1 <= k <= n. max(p)-min(p) = 0 iff k divides n, leaving n-d(n) with a difference of 1. It is easiest to see this by looking at fixed k with increasing n: for k=3, starting with n=3 the partitions are [1,1,1], [2,1,1], [2,2,1], [2,2,2], [3,2,2], etc. - Giovanni Resta, Feb 06 2006 and Franklin T. Adams-Watters, Jan 30 2011
Number of positive numbers in n-th row of array T given by A049816.
Number of proper non-divisors of n. - Omar E. Pol, May 25 2010
a(n+2) is the sum of the n-th antidiagonal of A225145. - Richard R. Forberg, May 02 2013
For n > 2, number of nonzero terms in n-th row of triangle A051778. - Reinhard Zumkeller, Dec 03 2014
Number of partitions of n of the form [j,j,...,j,i] (j > i). Example: a(7)=5 because we have [6,1], [5,2], [4,3], [3,3,1], and [2,2,2,1]. - Emeric Deutsch, Sep 22 2016

Examples

			a(7) = 5; the 5 non-divisors of 7 in 1..7 are 2, 3, 4, 5, and 6.
The 5 partitions of 7 with max(p) - min(p) = 1 are [4,3], [3,2,2], [2,2,2,1], [2,2,1,1,1] and [2,1,1,1,1,1]. - _Emeric Deutsch_, Mar 01 2006
		

Crossrefs

Cf. A000005.
One less than A062968, two less than A059292.
Cf. A161664 (partial sums).
Cf. A060990 (number of solutions to a(x) = n).
Cf. A045765 (numbers not occurring in this sequence).
Cf. A236561 (same sequence sorted into ascending order), A236562 (with also duplicates removed), A236565, A262901 and A262903.
Cf. A262511 (numbers that occur only once).
Cf. A055927 (positions of repeated terms).
Cf. A245388 (positions of squares).
Cf. A155043 (number of steps needed to reach zero when iterating a(n)), A262680 (number of nonzero squares encountered).
Cf. A259934 (an infinite trunk of the tree defined by edge-relation a(child) = parent, conjectured to be unique).
Cf. tables and arrays A047916, A051731, A051778, A173540, A173541.
Cf. also arrays A225145, A262898, A263255 and tables A263265, A263267.

Programs

Formula

a(n) = Sum_{k=1..n} ceiling(n/k)-floor(n/k). - Benoit Cloitre, May 11 2003
G.f.: Sum_{k>0} x^(2*k+1)/(1-x^k)/(1-x^(k+1)). - Emeric Deutsch, Mar 01 2006
a(n) = A006590(n) - A006218(n) = A161886(n) - A000005(n) - A006218(n) + 1 for n >= 1. - Jaroslav Krizek, Nov 14 2009
a(n) = Sum_{k=1..n} A000007(A051731(n,k)). - Reinhard Zumkeller, Mar 09 2010
a(n) = A076627(n) / A000005(n). - Reinhard Zumkeller, Feb 06 2012
For n >= 2, a(n) = A094181(n) / A051953(n). - Antti Karttunen, Nov 27 2015
a(n) = Sum_{k=1..n} ((n mod k) + (-n mod k))/k. - Wesley Ivan Hurt, Dec 28 2015
G.f.: Sum_{j>=2} (x^(j+1)*(1-x^(j-1))/(1-x^j))/(1-x). - Emeric Deutsch, Sep 22 2016
Dirichlet g.f.: zeta(s-1)- zeta(s)^2. - Ilya Gutkovskiy, Apr 12 2017
a(n) = Sum_{i=1..n-1} sign(i mod n-i). - Wesley Ivan Hurt, Sep 27 2018

Extensions

Edited by Franklin T. Adams-Watters, Jan 30 2012

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

A070824 Number of divisors of n which are > 1 and < n (nontrivial divisors).

Original entry on oeis.org

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

Views

Author

Wolfdieter Lang, May 08 2002

Keywords

Comments

These are sometimes called the proper divisors, but see A032741 for the usual meaning of that term.
a(n) = number of ordered factorizations of n into two factors, n = 2, 3, ... If n has the prime factorization n=Product p^e(j), j=1..r, the number of compositions of the vector (e(1), ..., e(r)) equals the number of ordered factorizations of n. Andrews (1998, page 59) gives a formula for the number of m-compositions of (e(1), ..., e(r)) which equals the number f(n,m) of ordered m-factorizations of n. But with m=2 the formula reduces to f(n,2) = d(n)-2 = a(n). - Augustine O. Munagi, Mar 31 2005
a(n) = 0 if and only if n is 1 or prime. - Jon Perry, Nov 08 2008
For n > 2: number of zeros in n-th row of triangle A051778. - Reinhard Zumkeller, Dec 03 2014
a(n) = number of partitions of n in which largest and least parts occur exactly once and their difference is 2. Example: a(12) = 4 because we have [7,5], [5,4,3], [4,3,3,2], and [3,2,2,2,2,1]. In general, if d is a nontrivial divisor of n, then [d+1,{d}^(n/d-2),d-1] is a partition of n of the prescribed type. - Emeric Deutsch, Nov 03 2015
Absolute values of the inverse Möbius transform of (-1)^prime(n), n >= 2. - Wesley Ivan Hurt, Jun 22 2024

Examples

			a(12) = 4 with the nontrivial divisors 2,3,4,6.
a(24) = 6 = card({{2,12},{3,8},{4,6},{6,4},{8,3},{12,2}}). - _Peter Luschny_, Nov 14 2011
		

References

  • George E. Andrews, The Theory of Partitions, Addison-Wesley, Reading 1976; reprinted, Cambridge University Press, Cambridge, 1984, 1998.

Crossrefs

First column in the matrix power A175992^2.
Row sums of A175992 starting from the second column.
Column k=2 of A251683.

Programs

  • Haskell
    a070824 n = if n == 1 then 0 else length $ tail $ a027751_row n -- Reinhard Zumkeller, Dec 03 2014
    
  • Maple
    0, seq(numtheory[tau](n)-2,n=2..100); # Augustine O. Munagi, Mar 31 2005
  • Mathematica
    Join[{0},Rest[DivisorSigma[0,Range[90]]-2]] (* Harvey P. Dale, Jun 23 2012 *)
    a[ n_] := SeriesCoefficient[ Sum[x^(2 k)/(1 - x^k), {k, 2, n/2}], {x, 0, n}]; (* Michael Somos, Jun 24 2019 *)
  • PARI
    {a(n) = if( n<1, 0, my(v = vector(n, i, i>1)); dirmul(v, v)[n])}; /* Michael Somos, Jun 24 2019 */
    
  • PARI
    apply( A070824(n)=numdiv(n+(n<2))-2, [1..90]) \\ M. F. Hasler, Oct 11 2019
    
  • Python
    from sympy import divisor_count
    def A070824(n): return 0 if n == 1 else divisor_count(n)-2 # Chai Wah Wu, Jun 03 2022

Formula

a(n) = A000005(n)-2, n>=2 (with the number-of-divisors function d(n) = A000005(n)).
a(n) = d(n)-2, for n>=2, where d(n) is the number-of-divisors function. E.g., a(12) = 4 because 12 has 4 ordered factorizations into two factors: 2*6, 6*2, 3*4, 4*3. - Augustine O. Munagi, Mar 31 2005
G.f.: Sum_{k>=2} x^(2k)/(1-x^k). - Jon Perry, Nov 08 2008
Dirichlet generating function: (zeta(s)-1)^2. - Mats Granvik May 25 2013
Sum_{k=1..n} a(k) ~ n*log(n) + (2*gamma - 3)*n, where gamma is Euler's constant (A001620). - Amiram Eldar, Nov 27 2022
a(n) = abs( Sum_{d|n} (-1)^prime(d) ), n >= 2 with a(1) = 0. - Wesley Ivan Hurt, Jun 22 2024
a(n) = Sum_{k=2..n-1} floor(n/k) - floor((n-1)/k), see Chhimpa and Yadav. - Stefano Spezia, Oct 13 2024

Extensions

a(1)=0 added by Peter Luschny, Nov 14 2011
Several minor edits by M. F. Hasler, Oct 14 2019

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

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 *)

A273619 Table read by antidiagonals (n>1, k>0): A(n,k) = leading digit of k in base n.

Original entry on oeis.org

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

Views

Author

Andrey Zabolotskiy, May 30 2016

Keywords

Comments

This is a generalization of A000030.
The first occurrence of a number k in the sequence is given by A(k+1,k).

Examples

			First few rows of the array are:
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2...
1, 2, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1...
1, 2, 3, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3...
1, 2, 3, 4, 5, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3...
1, 2, 3, 4, 5, 6, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2...
1, 2, 3, 4, 5, 6, 7, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2...
Note that the initial row is row 2.
A(3,3) corresponds to row n=3 and column k=3, and k=3 is written as 10 in base n=3, and the leading digit of 10 is 1, so A(3,3)=1.
A(12,11) corresponds to row n=12 and column k=11, and 11 is written as B in base 12, and the leading and only digit of B is B which is number 11 in decimal, so A(12,11)=11.
		

Crossrefs

Cf. A000030 (row 10), A122586 (row 3), A122587 (row 4).
Cf. A051777, A051778 (may be interpreted as arrays of last digits of k in base n).

Programs

  • Maple
    A:= (n,k) -> floor(k/n^floor(log[n](k))):
    seq(seq(A(n-k,k),k=1..n-2),n=2..20); # Robert Israel, May 31 2016
  • Mathematica
    a[n_, k_] := First[IntegerDigits[k, n]];
  • PARI
    T(n,k) = digits(k, n)[1];
    tabl(10, 10, n, k, n++; T(n,k)); \\ Michel Marcus, Jun 12 2016

Formula

From Robert Israel, May 31 2016: (Start)
A(n,k) = floor(k/n^floor(log_n(k))).
A(n,k) = k if n > k.
A(n,k) = A(n, floor(k/n)) otherwise.
G.f. of row n, G_n(x), satisfies G_n(x) = (1-x^n)/(1-x)^2 - (1+(n-1)*x^n)/(1-x) + (1-x^n)*G_n(x^n)/(1-x). (End)
Showing 1-7 of 7 results.