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 20 results. Next

A000005 d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

If the canonical factorization of n into prime powers is Product p^e(p) then d(n) = Product (e(p) + 1). More generally, for k > 0, sigma_k(n) = Product_p ((p^((e(p)+1)*k))-1)/(p^k-1) is the sum of the k-th powers of the divisors of n.
Number of ways to write n as n = x*y, 1 <= x <= n, 1 <= y <= n. For number of unordered solutions to x*y=n, see A038548.
Note that d(n) is not the number of Pythagorean triangles with radius of the inscribed circle equal to n (that is A078644). For number of primitive Pythagorean triangles having inradius n, see A068068(n).
Number of factors in the factorization of the polynomial x^n-1 over the integers. - T. D. Noe, Apr 16 2003
Also equal to the number of partitions p of n such that all the parts have the same cardinality, i.e., max(p)=min(p). - Giovanni Resta, Feb 06 2006
Equals A127093 as an infinite lower triangular matrix * the harmonic series, [1/1, 1/2, 1/3, ...]. - Gary W. Adamson, May 10 2007
For odd n, this is the number of partitions of n into consecutive integers. Proof: For n = 1, clearly true. For n = 2k + 1, k >= 1, map each (necessarily odd) divisor to such a partition as follows: For 1 and n, map k + (k+1) and n, respectively. For any remaining divisor d <= sqrt(n), map (n/d - (d-1)/2) + ... + (n/d - 1) + (n/d) + (n/d + 1) + ... + (n/d + (d-1)/2) {i.e., n/d plus (d-1)/2 pairs each summing to 2n/d}. For any remaining divisor d > sqrt(n), map ((d-1)/2 - (n/d - 1)) + ... + ((d-1)/2 - 1) + (d-1)/2 + (d+1)/2 + ((d+1)/2 + 1) + ... + ((d+1)/2 + (n/d - 1)) {i.e., n/d pairs each summing to d}. As all such partitions must be of one of the above forms, the 1-to-1 correspondence and proof is complete. - Rick L. Shepherd, Apr 20 2008
Number of subgroups of the cyclic group of order n. - Benoit Jubin, Apr 29 2008
Equals row sums of triangle A143319. - Gary W. Adamson, Aug 07 2008
Equals row sums of triangle A159934, equivalent to generating a(n) by convolving A000005 prefaced with a 1; (1, 1, 2, 2, 3, 2, ...) with the INVERTi transform of A000005, (A159933): (1, 1,-1, 0, -1, 2, ...). Example: a(6) = 4 = (1, 1, 2, 2, 3, 2) dot (2, -1, 0, -1, 1, 1) = (2, -1, 0, -2, 3, 2) = 4. - Gary W. Adamson, Apr 26 2009
Number of times n appears in an n X n multiplication table. - Dominick Cancilla, Aug 02 2010
Number of k >= 0 such that (k^2 + k*n + k)/(k + 1) is an integer. - Juri-Stepan Gerasimov, Oct 25 2015
The only numbers k such that tau(k) >= k/2 are 1,2,3,4,6,8,12. - Michael De Vlieger, Dec 14 2016
a(n) is also the number of partitions of 2*n into equal parts, minus the number of partitions of 2*n into consecutive parts. - Omar E. Pol, May 03 2017
From Tomohiro Yamada, Oct 27 2020: (Start)
Let k(n) = log d(n)*log log n/(log 2 * log n), then lim sup k(n) = 1 (Hardy and Wright, Chapter 18, Theorem 317) and k(n) <= k(6983776800) = 1.537939... (the constant A280235) for every n (Nicolas and Robin, 1983).
There exist infinitely many n such that d(n) = d(n+1) (Heath-Brown, 1984). The number of such integers n <= x is at least c*x/(log log x)^3 (Hildebrand, 1987) but at most O(x/sqrt(log log x)) (Erdős, Carl Pomerance and Sárközy, 1987). (End)
Number of 2D grids of n congruent rectangles with two different side lengths, in a rectangle, modulo rotation (cf. A038548 for squares instead of rectangles). Also number of ways to arrange n identical objects in a rectangle (NOT modulo rotation, cf. A038548 for modulo rotation); cf. A007425 and A140773 for the 3D case. - Manfred Boergens, Jun 08 2021
The constant quoted above from Nicolas and Robin, 6983776800 = 2^5 * 3^3 * 5^2 * 7 * 11 * 13 * 17 * 19, appears arbitrary, but interestingly equals 2 * A095849(36). That second factor is highly composite and deeply composite. - Hal M. Switkay, Aug 08 2025

Examples

			G.f. = x + 2*x^2 + 2*x^3 + 3*x^4 + 2*x^5 + 4*x^6 + 2*x^7 + 4*x^8 + 3*x^9 + ...
		

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 840.
  • T. M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 38.
  • G. Chrystal, Algebra: An elementary text-book for the higher classes of secondary schools and for colleges, 6th ed, Chelsea Publishing Co., New York 1959 Part II, p. 345, Exercise XXI(16). MR0121327 (22 #12066)
  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, p. 55.
  • G. H. Hardy and E. M. Wright, revised by D. R. Heath-Brown and J. H. Silverman, An Introduction to the Theory of Numbers, 6th ed., Oxford Univ. Press, 2008.
  • K. Knopp, Theory and Application of Infinite Series, Blackie, London, 1951, p. 451.
  • D. S. Mitrinovic et al., Handbook of Number Theory, Kluwer, Chap. II. (For inequalities, etc.)
  • S. Ramanujan, Collected Papers, Ed. G. H. Hardy et al., Cambridge 1927; Chelsea, NY, 1962. Has many references to this sequence. - N. J. A. Sloane, Jun 02 2014
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • B. Spearman and K. S. Williams, Handbook of Estimates in the Theory of Numbers, Carleton Math. Lecture Note Series No. 14, 1975; see p. 2.1.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 285.
  • E. C. Titchmarsh, The Theory of Functions, Oxford, 1938, p. 160.
  • Terence Tao, Poincaré's Legacies, Part I, Amer. Math. Soc., 2009, see pp. 31ff for upper bounds on d(n).

Crossrefs

See A002183, A002182 for records. See A000203 for the sum-of-divisors function sigma(n).
For partial sums see A006218.
Factorizations into given number of factors: writing n = x*y (A038548, unordered, A000005, ordered), n = x*y*z (A034836, unordered, A007425, ordered), n = w*x*y*z (A007426, ordered).
Cf. A098198 (Dgf at s=2), A183030 (Dgf at s=3), A183031 (Dgf at s=3).

Programs

  • GAP
    List([1..150],n->Tau(n)); # Muniru A Asiru, Mar 05 2019
    
  • Haskell
    divisors 1 = [1]
    divisors n = (1:filter ((==0) . rem n)
                   [2..n `div` 2]) ++ [n]
    a = length . divisors
    -- James Spahlinger, Oct 07 2012
    
  • Haskell
    a000005 = product . map (+ 1) . a124010_row  -- Reinhard Zumkeller, Jul 12 2013
    
  • Julia
    function tau(n)
        i = 2; num = 1
        while i * i <= n
            if rem(n, i) == 0
                e = 0
                while rem(n, i) == 0
                    e += 1
                    n = div(n, i)
                end
                num *= e + 1
            end
            i += 1
        end
        return n > 1 ? num + num : num
    end
    println([tau(n) for n in 1:104])  # Peter Luschny, Sep 03 2023
  • Magma
    [ NumberOfDivisors(n) : n in [1..100] ]; // Sergei Haller (sergei(AT)sergei-haller.de), Dec 21 2006
    
  • Maple
    with(numtheory): A000005 := tau; [ seq(tau(n), n=1..100) ];
  • Mathematica
    Table[DivisorSigma[0, n], {n, 100}] (* Enrique Pérez Herrero, Aug 27 2009 *)
    CoefficientList[Series[(Log[1 - q] + QPolyGamma[1, q])/(q Log[q]), {q, 0, 100}], q] (* Vladimir Reshetnikov, Apr 23 2013 *)
    a[ n_] := SeriesCoefficient[ (QPolyGamma[ 1, q] + Log[1 - q]) / Log[q], {q, 0, Abs@n}]; (* Michael Somos, Apr 25 2013 *)
    a[ n_] := SeriesCoefficient[ q/(1 - q)^2 QHypergeometricPFQ[ {q, q}, {q^2, q^2}, q, q^2], {q, 0, Abs@n}]; (* Michael Somos, Mar 05 2014 *)
    a[n_] := SeriesCoefficient[q/(1 - q) QHypergeometricPFQ[{q, q}, {q^2}, q, q], {q, 0, Abs@n}] (* Mats Granvik, Apr 15 2015 *)
    With[{M=500},CoefficientList[Series[(2x)/(1-x)-Sum[x^k (1-2x^k)/(1-x^k),{k,M}],{x,0,M}],x]] (* Mamuka Jibladze, Aug 31 2018 *)
  • MuPAD
    numlib::tau (n)$ n=1..90 // Zerinvary Lajos, May 13 2008
    
  • PARI
    {a(n) = if( n==0, 0, numdiv(n))}; /* Michael Somos, Apr 27 2003 */
    
  • PARI
    {a(n) = n=abs(n); if( n<1, 0, direuler( p=2, n, 1 / (1 - X)^2)[n])}; /* Michael Somos, Apr 27 2003 */
    
  • PARI
    {a(n)=polcoeff(sum(m=1, n+1, sumdiv(m, d, (-log(1-x^(m/d) +x*O(x^n) ))^d/d!)), n)} \\ Paul D. Hanna, Aug 21 2014
    
  • Python
    from sympy import divisor_count
    for n in range(1, 20): print(divisor_count(n), end=', ') # Stefano Spezia, Nov 05 2018
    
  • Sage
    [sigma(n, 0) for n in range(1, 105)]  # Zerinvary Lajos, Jun 04 2009
    

Formula

If n is written as 2^z*3^y*5^x*7^w*11^v*... then a(n)=(z+1)*(y+1)*(x+1)*(w+1)*(v+1)*...
a(n) = 2 iff n is prime.
G.f.: Sum_{n >= 1} a(n) x^n = Sum_{k>0} x^k/(1-x^k). This is usually called THE Lambert series (see Knopp, Titchmarsh).
a(n) = A083888(n) + A083889(n) + A083890(n) + A083891(n) + A083892(n) + A083893(n) + A083894(n) + A083895(n) + A083896(n).
a(n) = A083910(n) + A083911(n) + A083912(n) + A083913(n) + A083914(n) + A083915(n) + A083916(n) + A083917(n) + A083918(n) + A083919(n).
Multiplicative with a(p^e) = e+1. - David W. Wilson, Aug 01 2001
a(n) <= 2 sqrt(n) [see Mitrinovich, p. 39, also A046522].
a(n) is odd iff n is a square. - Reinhard Zumkeller, Dec 29 2001
a(n) = Sum_{k=1..n} f(k, n) where f(k, n) = 1 if k divides n, 0 otherwise (Mobius transform of A000012). Equivalently, f(k, n) = (1/k)*Sum_{l=1..k} z(k, l)^n with z(k, l) the k-th roots of unity. - Ralf Stephan, Dec 25 2002
G.f.: Sum_{k>0} ((-1)^(k+1) * x^(k * (k + 1)/2) / ((1 - x^k) * Product_{i=1..k} (1 - x^i))). - Michael Somos, Apr 27 2003
a(n) = n - Sum_{k=1..n} (ceiling(n/k) - floor(n/k)). - Benoit Cloitre, May 11 2003
a(n) = A032741(n) + 1 = A062011(n)/2 = A054519(n) - A054519(n-1) = A006218(n) - A006218(n-1) = 1 + Sum_{k=1..n-1} A051950(k+1). - Ralf Stephan, Mar 26 2004
G.f.: Sum_{k>0} x^(k^2)*(1+x^k)/(1-x^k). Dirichlet g.f.: zeta(s)^2. - Michael Somos, Apr 05 2003
Sequence = M*V where M = A129372 as an infinite lower triangular matrix and V = ruler sequence A001511 as a vector: [1, 2, 1, 3, 1, 2, 1, 4, ...]. - Gary W. Adamson, Apr 15 2007
Sequence = M*V, where M = A115361 is an infinite lower triangular matrix and V = A001227, the number of odd divisors of n, is a vector: [1, 1, 2, 1, 2, 2, 2, ...]. - Gary W. Adamson, Apr 15 2007
Row sums of triangle A051731. - Gary W. Adamson, Nov 02 2007
Sum_{n>0} a(n)/(n^n) = Sum_{n>0, m>0} 1/(n*m). - Gerald McGarvey, Dec 15 2007
Logarithmic g.f.: Sum_{n>=1} a(n)/n * x^n = -log( Product_{n>=1} (1-x^n)^(1/n) ). - Joerg Arndt, May 03 2008
a(n) = Sum_{k=1..n} (floor(n/k) - floor((n-1)/k)). - Enrique Pérez Herrero, Aug 27 2009
a(s) = 2^omega(s), if s > 1 is a squarefree number (A005117) and omega(s) is: A001221. - Enrique Pérez Herrero, Sep 08 2009
a(n) = A048691(n) - A055205(n). - Reinhard Zumkeller, Dec 08 2009
For n > 1, a(n) = 2 + Sum_{k=2..n-1} floor((cos(Pi*n/k))^2). And floor((cos(Pi*n/k))^2) = floor(1/4 * e^(-(2*i*Pi*n)/k) + 1/4 * e^((2*i*Pi*n)/k) + 1/2). - Eric Desbiaux, Mar 09 2010, corrected Apr 16 2011
a(n) = 1 + Sum_{k=1..n} (floor(2^n/(2^k-1)) mod 2) for every n. - Fabio Civolani (civox(AT)tiscali.it), Mar 12 2010
From Vladimir Shevelev, May 22 2010: (Start)
(Sum_{d|n} a(d))^2 = Sum_{d|n} a(d)^3 (J. Liouville).
Sum_{d|n} A008836(d)*a(d)^2 = A008836(n)*Sum_{d|n} a(d). (End)
a(n) = sigma_0(n) = 1 + Sum_{m>=2} Sum_{r>=1} (1/m^(r+1))*Sum_{j=1..m-1} Sum_{k=0..m^(r+1)-1} e^(2*k*Pi*i*(n+(m-j)*m^r)/m^(r+1)). - A. Neves, Oct 04 2010
a(n) = 2*A038548(n) - A010052(n). - Reinhard Zumkeller, Mar 08 2013
Sum_{n>=1} a(n)*q^n = (log(1-q) + psi_q(1)) / log(q), where psi_q(z) is the q-digamma function. - Vladimir Reshetnikov, Apr 23 2013
a(n) = Product_{k = 1..A001221(n)} (A124010(n,k) + 1). - Reinhard Zumkeller, Jul 12 2013
a(n) = Sum_{k=1..n} A238133(k)*A000041(n-k). - Mircea Merca, Feb 18 2013
G.f.: Sum_{k>=1} Sum_{j>=1} x^(j*k). - Mats Granvik, Jun 15 2013
The formula above is obtained by expanding the Lambert series Sum_{k>=1} x^k/(1-x^k). - Joerg Arndt, Mar 12 2014
G.f.: Sum_{n>=1} Sum_{d|n} ( -log(1 - x^(n/d)) )^d / d!. - Paul D. Hanna, Aug 21 2014
2*Pi*a(n) = Sum_{m=1..n} Integral_{x=0..2*Pi} r^(m-n)( cos((m-n)*x)-r^m cos(n*x) )/( 1+r^(2*m)-2r^m cos(m*x) )dx, 0 < r < 1 a free parameter. This formula is obtained as the sum of the residues of the Lambert series Sum_{k>=1} x^k/(1-x^k). - Seiichi Kirikami, Oct 22 2015
a(n) = A091220(A091202(n)) = A106737(A156552(n)). - Antti Karttunen, circa 2004 & Mar 06 2017
a(n) = A034296(n) - A237665(n+1) [Wang, Fokkink, Fokkink]. - George Beck, May 06 2017
G.f.: 2*x/(1-x) - Sum_{k>0} x^k*(1-2*x^k)/(1-x^k). - Mamuka Jibladze, Aug 29 2018
a(n) = Sum_{k=1..n} 1/phi(n / gcd(n, k)). - Daniel Suteu, Nov 05 2018
a(k*n) = a(n)*(f(k,n)+2)/(f(k,n)+1), where f(k,n) is the exponent of the highest power of k dividing n and k is prime. - Gary Detlefs, Feb 08 2019
a(n) = 2*log(p(n))/log(n), n > 1, where p(n)= the product of the factors of n = A007955(n). - Gary Detlefs, Feb 15 2019
a(n) = (1/n) * Sum_{k=1..n} sigma(gcd(n,k)), where sigma(n) = sum of divisors of n. - Orges Leka, May 09 2019
a(n) = A001227(n)*(A007814(n) + 1) = A001227(n)*A001511(n). - Ivan N. Ianakiev, Nov 14 2019
From Richard L. Ollerton, May 11 2021: (Start)
a(n) = A038040(n) / n = (1/n)*Sum_{d|n} phi(d)*sigma(n/d), where phi = A000010 and sigma = A000203.
a(n) = (1/n)*Sum_{k=1..n} phi(gcd(n,k))*sigma(n/gcd(n,k))/phi(n/gcd(n,k)). (End)
From Ridouane Oudra, Nov 12 2021: (Start)
a(n) = Sum_{j=1..n} Sum_{k=1..j} (1/j)*cos(2*k*n*Pi/j);
a(n) = Sum_{j=1..n} Sum_{k=1..j} (1/j)*e^(2*k*n*Pi*i/j), where i^2=-1. (End)

Extensions

Incorrect formula deleted by Ridouane Oudra, Oct 28 2021

A027383 a(2*n) = 3*2^n - 2; a(2*n+1) = 2^(n+2) - 2.

Original entry on oeis.org

1, 2, 4, 6, 10, 14, 22, 30, 46, 62, 94, 126, 190, 254, 382, 510, 766, 1022, 1534, 2046, 3070, 4094, 6142, 8190, 12286, 16382, 24574, 32766, 49150, 65534, 98302, 131070, 196606, 262142, 393214, 524286, 786430, 1048574, 1572862, 2097150, 3145726, 4194302, 6291454
Offset: 0

Views

Author

Keywords

Comments

Number of balanced strings of length n: let d(S) = #(1's) - #(0's), # == count in S, then S is balanced if every substring T of S has -2 <= d(T) <= 2.
Number of "fold lines" seen when a rectangular piece of paper is folded n+1 times along alternate orthogonal directions and then unfolded. - Quim Castellsaguer (qcastell(AT)pie.xtec.es), Dec 30 1999
Also the number of binary strings with the property that, when scanning from left to right, once the first 1 is seen in position j, there must be a 1 in positions j+2, j+4, ... until the end of the string. (Positions j+1, j+3, ... can be occupied by 0 or 1.) - Jeffrey Shallit, Sep 02 2002
a(n-1) is also the Moore lower bound on the order of a (3,n)-cage. - Eric W. Weisstein, May 20 2003 and Jason Kimberley, Oct 30 2011
Partial sums of A016116. - Hieronymus Fischer, Sep 15 2007
Equals row sums of triangle A152201. - Gary W. Adamson, Nov 29 2008
From John P. McSorley, Sep 28 2010: (Start)
a(n) = DPE(n+1) is the total number of k-double-palindromes of n up to cyclic equivalence. See sequence A180918 for the definitions of a k-double-palindrome of n and of cyclic equivalence. Sequence A180918 is the 'DPE(n,k)' triangle read by rows where DPE(n,k) is the number of k-double-palindromes of n up to cyclic equivalence. For example, we have a(4) = DPE(5) = DPE(5,1) + DPE(5,2) + DPE(5,3) + DPE(5,4) + DPE(5,5) = 0 + 2 + 2 + 1 + 1 = 6.
The 6 double-palindromes of 5 up to cyclic equivalence are 14, 23, 113, 122, 1112, 11111. They come from cyclic equivalence classes {14,41}, {23,32}, {113,311,131}, {122,212,221}, {1112,2111,1211,1121}, and {11111}. Hence a(n)=DPE(n+1) is the total number of cyclic equivalence classes of n containing at least one double-palindrome.
(End)
From Herbert Eberle, Oct 02 2015: (Start)
For n > 0, there is a red-black tree of height n with a(n-1) internal nodes and none with less.
In order a red-black tree of given height has minimal number of nodes, it has exactly 1 path with strictly alternating red and black nodes. All nodes outside this height defining path are black.
Consider:
mrbt5 R
/ \
/ \
/ \
/ B
/ / \
mrbt4 B / B
/ \ B E E
/ B E E
mrbt3 R E E
/ \
/ B
mrbt2 B E E
/ E
mrbt1 R
E E
(Red nodes shown as R, blacks as B, externals as E.)
Red-black trees mrbt1, mrbt2, mrbt3, mrbt4, mrbt5 of respective heights h = 1, 2, 3, 4, 5; all minimal in the number of internal nodes, namely 1, 2, 4, 6, 10.
Recursion (let n = h-1): a(-1) = 0, a(n) = a(n-1) + 2^floor(n/2), n >= 0.
(End)
Also the number of strings of length n with the digits 1 and 2 with the property that the sum of the digits of all substrings of uneven length is not divisible by 3. An example with length 8 is 21221121. - Herbert Kociemba, Apr 29 2017
a(n-2) is the number of achiral n-bead necklaces or bracelets using exactly two colors. For n=4, the four arrangements are AAAB, AABB, ABAB, and ABBB. - Robert A. Russell, Sep 26 2018
Partial sums of powers of 2 repeated 2 times, like A200672 where is 3 times. - Yuchun Ji, Nov 16 2018
Also the number of binary words of length n with cuts-resistance <= 2, where, for the operation of shortening all runs by one, cuts-resistance is the number of applications required to reach an empty word. Explicitly, these are words whose sequence of run-lengths, all of which are 1 or 2, has no odd-length run of 1's sandwiched between two 2's. - Gus Wiseman, Nov 28 2019
Also the number of up-down paths with n steps such that the height difference between the highest and lowest points is at most 2. - Jeremy Dover, Jun 17 2020
Also the number of non-singleton integer compositions of n + 2 with no odd part other than the first or last. Including singletons gives A052955. This is an unsorted (or ordered) version of A351003. The version without even (instead of odd) interior parts is A001911, complement A232580. Note that A000045(n-1) counts compositions without odd parts, with non-singleton case A077896, and A052952/A074331 count non-singleton compositions without even parts. Also the number of compositions y of n + 1 such that y_i = y_{i+1} for all even i. - Gus Wiseman, Feb 19 2022

Examples

			After 3 folds one sees 4 fold lines.
Example: a(3) = 6 because the strings 001, 010, 100, 011, 101, 110 have the property.
Binary: 1, 10, 100, 110, 1010, 1110, 10110, 11110, 101110, 111110, 1011110, 1111110, 10111110, 11111110, 101111110, 111111110, 1011111110, 1111111110, 10111111110, ... - _Jason Kimberley_, Nov 02 2011
Example: Partial sums of powers of 2 repeated 2 times:
a(3) = 1+1+2 = 4;
a(4) = 1+1+2+2 = 6;
a(5) = 1+1+2+2+4 = 10.
_Yuchun Ji_, Nov 16 2018
		

References

  • John P. McSorley: Counting k-compositions of n with palindromic and related structures. Preprint, 2010. [John P. McSorley, Sep 28 2010]

Crossrefs

Moore lower bound on the order of a (k,g) cage: A198300 (square); rows: A000027 (k=2), this sequence (k=3), A062318 (k=4), A061547 (k=5), A198306 (k=6), A198307 (k=7), A198308 (k=8), A198309 (k=9), A198310 (k=10), A094626 (k=11); columns: A020725 (g=3), A005843 (g=4), A002522 (g=5), A051890 (g=6), A188377 (g=7). - Jason Kimberley, Oct 30 2011
Cf. A000066 (actual order of a (3,g)-cage).
Bisections are A033484 (even) and A000918 (odd).
a(n) = A305540(n+2,2), the second column of the triangle.
Numbers whose binary expansion is a balanced word are A330029.
Binary words counted by cuts-resistance are A319421 or A329860.
The complementary compositions are counted by A274230(n-1) + 1, with bisections A060867 (even) and A134057 (odd).
Cf. A000346, A000984, A001405, A001700, A011782 (compositions).
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A029744 = {s(n), n>=1}, the numbers 2^k and 3*2^k, as the parent: A029744 (s(n)); A052955 (s(n)-1), A027383 (s(n)-2), A354788 (s(n)-3), A347789 (s(n)-4), A209721 (s(n)+1), A209722 (s(n)+2), A343177 (s(n)+3), A209723 (s(n)+4); A060482, A136252 (minor differences from A354788 at the start); A354785 (3*s(n)), A354789 (3*s(n)-7). The first differences of A029744 are 1,1,1,2,2,4,4,8,8,... which essentially matches eight sequences: A016116, A060546, A117575, A131572, A152166, A158780, A163403, A320770. The bisections of A029744 are A000079 and A007283. - N. J. A. Sloane, Jul 14 2022

Programs

  • Haskell
    import Data.List (transpose)
    a027383 n = a027383_list !! n
    a027383_list = concat $ transpose [a033484_list, drop 2 a000918_list]
    -- Reinhard Zumkeller, Jun 17 2015
    
  • Magma
    [2^Floor((n+2)/2)+2^Floor((n+1)/2)-2: n in [0..50]]; // Vincenzo Librandi, Aug 16 2011
    
  • Maple
    a[0]:=0:a[1]:=1:for n from 2 to 100 do a[n]:=2*a[n-2]+2 od: seq(a[n], n=1..41); # Zerinvary Lajos, Mar 16 2008
  • Mathematica
    a[n_?EvenQ] := 3*2^(n/2)-2; a[n_?OddQ] := 2^(2+(n-1)/2)-2; Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Oct 21 2011, after Quim Castellsaguer *)
    LinearRecurrence[{1, 2, -2}, {1, 2, 4}, 41] (* Robert G. Wilson v, Oct 06 2014 *)
    Table[Length[Select[Tuples[{0,1},n],And[Max@@Length/@Split[#]<=2,!MatchQ[Length/@Split[#],{_,2,ins:1..,2,_}/;OddQ[Plus[ins]]]]&]],{n,0,15}] (* Gus Wiseman, Nov 28 2019 *)
  • PARI
    a(n)=2^(n\2+1)+2^((n+1)\2)-2 \\ Charles R Greathouse IV, Oct 21 2011
    
  • Python
    def a(n): return 2**((n+2)//2) + 2**((n+1)//2) - 2
    print([a(n) for n in range(43)]) # Michael S. Branicky, Feb 19 2022

Formula

a(0)=1, a(1)=2; thereafter a(n+2) = 2*a(n) + 2.
a(2n) = 3*2^n - 2 = A033484(n);
a(2n-1) = 2^(n+1) - 2 = A000918(n+1).
G.f.: (1 + x)/((1 - x)*(1 - 2*x^2)). - David Callan, Jul 22 2008
a(n) = Sum_{k=0..n} 2^min(k, n-k).
a(n) = 2^floor((n+2)/2) + 2^floor((n+1)/2) - 2. - Quim Castellsaguer (qcastell(AT)pie.xtec.es)
a(n) = 2^(n/2)*(3 + 2*sqrt(2) + (3-2*sqrt(2))*(-1)^n)/2 - 2. - Paul Barry, Apr 23 2004
a(n) = A132340(A052955(n)). - Reinhard Zumkeller, Aug 20 2007
a(n) = A052955(n+1) - 1. - Hieronymus Fischer, Sep 15 2007
a(n) = A132666(a(n+1)) - 1. - Hieronymus Fischer, Sep 15 2007
a(n) = A132666(a(n-1)+1) for n > 0. - Hieronymus Fischer, Sep 15 2007
A132666(a(n)) = a(n-1) + 1 for n > 0. - Hieronymus Fischer, Sep 15 2007
G.f.: (1 + x)/((1 - x)*(1 - 2*x^2)). - David Callan, Jul 22 2008
a(n) = 2*( (a(n-2)+1) mod (a(n-1)+1) ), n > 1. - Pierre Charland, Dec 12 2010
a(n) = A136252(n-1) + 1, for n > 0. - Jason Kimberley, Nov 01 2011
G.f.: (1+x*R(0))/(1-x), where R(k) = 1 + 2*x/( 1 - x/(x + 1/R(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Aug 16 2013
a(n) = 2^((2*n + 3*(1-(-1)^n))/4)*3^((1+(-1)^n)/2) - 2. - Luce ETIENNE, Sep 01 2014
a(n) = a(n-1) + 2^floor((n-1)/2) for n>0, a(0)=1. - Yuchun Ji, Nov 23 2018
E.g.f.: 3*cosh(sqrt(2)*x) - 2*cosh(x) + 2*sqrt(2)*sinh(sqrt(2)*x) - 2*sinh(x). - Stefano Spezia, Apr 06 2022

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Mar 24 2000
Replaced definition with a simpler one. - N. J. A. Sloane, Jul 09 2022

A221530 Triangle read by rows: T(n,k) = A000005(k)*A000041(n-k).

Original entry on oeis.org

1, 1, 2, 2, 2, 2, 3, 4, 2, 3, 5, 6, 4, 3, 2, 7, 10, 6, 6, 2, 4, 11, 14, 10, 9, 4, 4, 2, 15, 22, 14, 15, 6, 8, 2, 4, 22, 30, 22, 21, 10, 12, 4, 4, 3, 30, 44, 30, 33, 14, 20, 6, 8, 3, 4, 42, 60, 44, 45, 22, 28, 10, 12, 6, 4, 2, 56, 84, 60, 66, 30, 44, 14, 20, 9, 8, 2, 6
Offset: 1

Views

Author

Omar E. Pol, Jan 19 2013

Keywords

Comments

T(n,k) is the number of partitions of n that contain k as a part multiplied by the number of divisors of k.
It appears that T(n,k) is also the total number of appearances of k in the last k sections of the set of partitions of n multiplied by the number of divisors of k.
T(n,k) is also the number of partitions of k into equal parts multiplied by the number of ones in the j-th section of the set of partitions of n, where j = (n - k + 1).
For another version see A245095. - Omar E. Pol, Jul 15 2014

Examples

			For n = 6:
  -------------------------
  k   A000005        T(6,k)
  1      1  *  7   =    7
  2      2  *  5   =   10
  3      2  *  3   =    6
  4      3  *  2   =    6
  5      2  *  1   =    2
  6      4  *  1   =    4
  .         A000041
  -------------------------
So row 6 is [7, 10, 6, 6, 4, 2]. Note that the sum of row 6 is 7+10+6+6+2+4 = 35 equals A006128(6).
.
Triangle begins:
  1;
  1,   2;
  2,   2,  2;
  3,   4,  2,  3;
  5,   6,  4,  3,  2;
  7,  10,  6,  6,  2,  4;
  11, 14, 10,  9,  4,  4,  2;
  15, 22, 14, 15,  6,  8,  2,  4;
  22, 30, 22, 21, 10, 12,  4,  4,  3;
  30, 44, 30, 33, 14, 20,  6,  8,  3,  4;
  42, 60, 44, 45, 22, 28, 10, 12,  6,  4,  2;
  56, 84, 60, 66, 30, 44, 14, 20,  9,  8,  2,  6;
  ...
		

Crossrefs

Similar to A221529.
Columns 1-2: A000041, A139582. Leading diagonals 1-3: A000005, A000005, A062011. Row sums give A006128.

Programs

  • Mathematica
    A221530row[n_]:=DivisorSigma[0,Range[n]]PartitionsP[n-Range[n]];Array[A221530row,10] (* Paolo Xausa, Sep 04 2023 *)
  • PARI
    row(n) = vector(n, i, numdiv(i)*numbpart(n-i)); \\ Michel Marcus, Jul 18 2014

Formula

T(n,k) = d(k)*p(n-k) = A000005(k)*A027293(n,k).

A221531 Triangle read by rows: T(n,k) = A000005(n-k+1)*A000041(k-1), n>=1, k>=1.

Original entry on oeis.org

1, 2, 1, 2, 2, 2, 3, 2, 4, 3, 2, 3, 4, 6, 5, 4, 2, 6, 6, 10, 7, 2, 4, 4, 9, 10, 14, 11, 4, 2, 8, 6, 15, 14, 22, 15, 3, 4, 4, 12, 10, 21, 22, 30, 22, 4, 3, 8, 6, 20, 14, 33, 30, 44, 30, 2, 4, 6, 12, 10, 28, 22, 45, 44, 60, 42, 6, 2, 8, 9, 20, 14, 44, 30, 66, 60, 84, 56
Offset: 1

Views

Author

Omar E. Pol, Jan 19 2013

Keywords

Examples

			For n = 6:
-------------------------
k   A000041        T(6,k)
1      1  *  4   =    4
2      1  *  2   =    2
3      2  *  3   =    6
4      3  *  2   =    6
5      5  *  2   =   10
6      7  *  1   =    7
.         A000005
-------------------------
So row 6 is [4, 2, 6, 6, 10, 7]. Note that the sum of row 6 is 4+2+6+6+10+7 = 35 equals A006128(6).
.
Triangle begins:
1;
2,  1;
2,  2,  2;
3,  2,  4,  3;
2,  3,  4,  6, 5;
4,  2,  6,  6, 10, 7;
2,  4,  4,  9, 10, 14, 11;
4,  2,  8,  6, 15, 14, 22, 15;
3,  4,  4, 12, 10, 21, 22, 30, 22;
4,  3,  8,  6, 20, 14, 33, 30, 44, 30;
2,  4,  6, 12, 10, 28, 22, 45, 44, 60, 42;
6,  2,  8,  9, 20, 14, 44, 30, 66, 60, 84, 56;
...
		

Crossrefs

Mirror of A221530. Columns 1-3: A000005, A000005, A062011. Leading diagonals 1-2: A000041, A139582. Row sums give A006128.

Formula

T(n,k) = d(n-k+1)*p(k-1), n>=1, k>=1.

A235790 Triangle read by rows: T(n,k) = 2^k*A116608(n,k), n>=1, k>=1.

Original entry on oeis.org

2, 4, 4, 4, 6, 8, 4, 20, 8, 24, 8, 4, 44, 16, 8, 52, 40, 6, 68, 80, 8, 88, 120, 16, 4, 108, 200, 32, 12, 116, 296, 80, 4, 148, 416, 160, 8, 176, 536, 320, 8, 176, 776, 480, 32, 10, 220, 936, 832, 64, 4, 236, 1232, 1232, 160, 12, 272, 1472, 1872, 320
Offset: 1

Views

Author

Omar E. Pol, Jan 18 2014

Keywords

Comments

It appears that T(n,k) is the number of overpartitions of n having k distinct parts. (This is true by definition, Joerg Arndt, Jan 20 2014).
Row n has length A003056(n) hence the first element of column k is in row A000217(k).
The first element of column k is A000079(k).

Examples

			Triangle begins:
2;
4;
4,    4;
6,    8;
4,   20;
8,   24,    8;
4,   44,   16;
8,   52,   40;
6,   68,   80;
8,   88,  120,   16;
4,  108,  200,   32;
12, 116,  296,   80;
4,  148,  416,  160;
8,  176,  536,  320;
8,  176,  776,  480,   32;
10, 220,  936,  832,   64;
4,  236, 1232, 1232,  160;
12, 272, 1472, 1872,  320;
4,  284, 1880, 2592,  640;
12, 324, 2216, 3632, 1152;
8,  328, 2704, 4944, 1856, 64;
...
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
          expand(b(n, i-1)+add(x*b(n-i*j, i-1), j=1..n/i))))
        end:
    T:= n->(p->seq(2^i*coeff(p, x, i), i=1..degree(p)))(b(n$2)):
    seq(T(n), n=1..20);  # Alois P. Heinz, Jan 20 2014
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, 1, If[i<1, 0, Expand[b[n, i-1] + Sum[x*b[n-i*j, i-1], {j, 1, n/i}]]]]; T[n_] := Function[p, Table[2^i * Coefficient[p, x, i], {i, 1, Exponent[p, x]}]][b[n, n]]; Table[T[n], {n, 1, 20}] // Flatten (* Jean-François Alcover, Oct 20 2016, after Alois P. Heinz *)

A216620 Square array read by antidiagonals: T(n,k) = Sum_{c|n,d|k} phi(gcd(c,d)) for n>=1, k>=1.

Original entry on oeis.org

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

Views

Author

Peter Luschny, Sep 12 2012

Keywords

Comments

T(n,n) = A060648(n) = Sum_{d|n} Dedekind_Psi(d).
T(n,1) = T(1,n) = A000005(n) = tau(n).
T(n,2) = T(2,n) = A062011(n) = 2*tau(n).
T(n+1,n) = A092517(n) = tau(n+1)*tau(n).
T(prime(n),1) = A007395(n) = 2.
T(prime(n),prime(n)) = A052147(n) = prime(n)+2.

Examples

			[----1---2---3---4---5---6---7---8---9--10--11--12]
[ 1] 1,  2,  2,  3,  2,  4,  2,  4,  3,  4,  2,  6
[ 2] 2,  4,  4,  6,  4,  8,  4,  8,  6,  8,  4, 12
[ 3] 2,  4,  5,  6,  4, 10,  4,  8,  8,  8,  4, 15
[ 4] 3,  6,  6, 10,  6, 12,  6, 14,  9, 12,  6, 20
[ 5] 2,  4,  4,  6,  7,  8,  4,  8,  6, 14,  4, 12
[ 6] 4,  8, 10, 12,  8, 20,  8, 16, 16, 16,  8, 30
[ 7] 2,  4,  4,  6,  4,  8,  9,  8,  6,  8,  4, 12
[ 8] 4,  8,  8, 14,  8, 16,  8, 22, 12, 16,  8, 28
[ 9] 3,  6,  8,  9,  6, 16,  6, 12, 17, 12,  6, 24
[10] 4,  8,  8, 12, 14, 16,  8, 16, 12, 28,  8, 24
[11] 2,  4,  4,  6,  4,  8,  4,  8,  6,  8, 13, 12
[12] 6, 12, 15, 20, 12, 30, 12, 28, 24, 24, 12, 50
.
Displayed as a triangular array:
   1,
   2, 2,
   2, 4,  2,
   3, 4,  4,  3,
   2, 6,  5,  6, 2,
   4, 4,  6,  6, 4,  4,
   2, 8,  4, 10, 4,  8, 2,
   4, 4, 10,  6, 6, 10, 4, 4,
   3, 8,  4, 12, 7, 12, 4, 8, 3,
		

Crossrefs

Programs

  • Maple
    with(numtheory):
    T:= (n, k)-> add(add(phi(igcd(c,d)), c=divisors(n)), d=divisors(k)):
    seq(seq(T(n, 1+d-n), n=1..d), d=1..14);  # Alois P. Heinz, Sep 12 2012
  • Mathematica
    t[n_, k_] := Outer[ EulerPhi[ GCD[#1, #2]]&, Divisors[n], Divisors[k]] // Flatten // Total; Table[ t[n-k+1, k], {n, 1, 13}, {k, 1, n}] // Flatten (* Jean-François Alcover, Jun 26 2013 *)
  • Sage
    def A216620(n, k) :
        cp = cartesian_product([divisors(n), divisors(k)])
        return reduce(lambda x,y: x+y, map(euler_phi, map(gcd, cp)))
    for n in (1..12): [A216620(n,k) for k in (1..12)]

A235999 Triangle read by rows: T(n,k) = 2^k*A235998(n,k), n>=1, k>=1.

Original entry on oeis.org

2, 4, 4, 8, 6, 20, 4, 56, 8, 88, 48, 4, 176, 144, 8, 272, 448, 6, 428, 1168, 8, 688, 2496, 384, 4, 1044, 5416, 1344, 12, 1584, 10864, 4608, 4, 2424, 21328, 13152, 8, 3800, 40096, 35616, 8, 5656, 76336, 84864, 3840, 10, 8952, 140248, 200224, 15360
Offset: 1

Views

Author

Omar E. Pol, Jan 19 2014

Keywords

Comments

T(n,k) is also the number of overcompositions of n having k distinct parts. For the definition of overcomposition see A236002.
Row n has length A003056(n) hence the first element of column k is in row A000217(k).
Row sums give A236002, n >= 1.
Column 1 is A062011.
T(k*(k+1)/2,k) = T(A000217(k),k) = A000165(k) = (2*k)!!. - Alois P. Heinz, Jan 20 2014

Examples

			Triangle begins:
2;
4;
4,     8;
6,    20;
4,    56;
8,    88,     48;
4,   176,    144;
8,   272,    448;
6,   428,   1168;
8,   688,   2496,    384;
4,  1044,   5416,   1344;
12, 1584,  10864,   4608;
4,  2424,  21328,  13152;
8,  3800,  40096,  35616;
8,  5656,  76336,  84864,  3840;
10, 8952, 140248, 200224, 15360;
...
		

Crossrefs

Extensions

More terms from Alois P. Heinz, Jan 20 2014

A328065 Amicable pairs with the property that the number of divisors of the smaller member is twice the number of divisors of the larger member.

Original entry on oeis.org

220, 284, 12285, 14595, 17296, 18416, 63020, 76084, 69615, 87633, 79750, 88730, 100485, 124155, 122265, 139815, 142310, 168730, 185368, 203432, 308620, 389924, 356408, 399592, 600392, 669688, 609928, 686072, 624184, 691256, 635624, 712216, 643336, 652664, 667964, 783556, 726104, 796696, 898216, 980984
Offset: 1

Views

Author

Omar E. Pol, Oct 03 2019

Keywords

Comments

Amicable pairs(x,y) such that d(x) = 2*d(y), where d(n) is the number of divisors of n.

Examples

			Consider the amicable pair [220, 284]. The smaller member has 12 divisors, they are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110, 220. The larger member has 6 divisors, they are 1, 2, 4, 71, 142, 284. The number of divisors of 220 is twice the number of divisors of 284, so the amicable pair [220, 284] is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    seq = {}; s[n_] := DivisorSigma[1, n] - n; Do[m = s[n]; If[m > n && s[m] == n && DivisorSigma[0, n] == 2 * DivisorSigma[0, m], seq = Join[seq, {n, m}]], {n, 1, 10^6}]; seq (* Amiram Eldar, Oct 11 2019 *)

A060710 Number of subgroups of dihedral group with 2n elements, counting conjugate subgroups only once, i.e., conjugacy classes of subgroups of the dihedral group.

Original entry on oeis.org

2, 5, 4, 8, 4, 10, 4, 11, 6, 10, 4, 16, 4, 10, 8, 14, 4, 15, 4, 16, 8, 10, 4, 22, 6, 10, 8, 16, 4, 20, 4, 17, 8, 10, 8, 24, 4, 10, 8, 22, 4, 20, 4, 16, 12, 10, 4, 28, 6, 15, 8, 16, 4, 20, 8, 22, 8, 10, 4, 32, 4, 10, 12, 20, 8, 20, 4, 16, 8, 20, 4, 33, 4, 10, 12, 16, 8, 20, 4, 28, 10, 10, 4
Offset: 1

Views

Author

Avi Peretz (njk(AT)netvision.net.il), Apr 21 2001

Keywords

Comments

The total number of subgroups, counting conjugate subgroups as distinct, is A007503.
Also the number of subgroups of the group C_n x C_2 (where C_n is the cyclic group with n elements).

Examples

			The dihedral group D6 is isomorphic to the symmetric group S_3 and the conjugacy classes of subgroups are: the trivial group, the whole group, subgroup of order 2 generated by a transposition and the subgroup A_3 generated by the 3-cycles. So a(3) = 4.
		

Crossrefs

A row of A216624.

Programs

  • Mathematica
    a[n_] := DivisorSum[n, 3-Mod[#,2]&];
    Array[a, 100] (* Jean-François Alcover, Jun 03 2019 *)
  • PARI
    a(n)=if(n<1, 0, sumdiv(n,d, 3-d%2)) /* Michael Somos, Sep 20 2005 */
    
  • PARI
    { for (n=1, 1000, write("b060710.txt", n, " ", sumdiv(n, d, 3 - d%2)); ) } \\ Harry J. Smith, Jul 10 2009
    
  • Sage
    def A060710(n): return add(3 - int(is_odd(d)) for d in divisors(n))
    [A060710(n) for n in (1..83)] # Peter Luschny, Sep 12 2012

Formula

For even n, a(n) = 2*tau(n) + tau(n/2).
For odd n, a(n) = tau(2n) = 2*tau(n) = 2*A000005(n). - Ahmed Fares (ahmedfares(AT)my-deja.com), Jul 12 2001
From Michael Somos, Sep 20 2005: (Start)
Moebius transform is period 2 sequence [2, 3, ...].
G.f.: Sum_{k>0} x^k*(2+3x^k)/(1-x^(2k)) = Sum_{k>0} 2*x^(2k-1)/(1-x^(2k-1)) + 3*x^(2k)/(1-x^(2k)). (End)
a(n) = 4*tau(n) - tau(2n). - Ridouane Oudra, Jan 16 2023
Sum_{k=1..n} a(k) ~ n*(5*log(n) + 10*gamma - log(2) - 5)/2, where gamma is Euler's constant (A001622). - Amiram Eldar, Jan 21 2023

Extensions

More terms from Vladeta Jovovic, Jul 15 2001

A106634 Number of ways to express n as i*j+k*l, with i,j,k,l in the range [0..n].

Original entry on oeis.org

1, 6, 21, 32, 62, 58, 124, 88, 173, 158, 226, 156, 380, 194, 340, 356, 466, 274, 613, 316, 690, 536, 596, 404, 1060, 552, 734, 728, 1032, 546, 1376, 596, 1213, 932, 1026, 976, 1858, 750, 1180, 1144, 1910, 854, 2048, 908, 1784, 1730, 1500, 1016, 2800
Offset: 0

Views

Author

Ralf Stephan, May 06 2005

Keywords

Comments

Number of ordered 4-tuples [i,j,k,l] with n=i*j+k*l and i,j,k,l in the range [0..n].
a(n) is odd iff n is in A001105.

Examples

			a(1)=6: the 4-tuples ijkl are 1100, 1101, 1110, 0011, 0111, 1011.
a(2)=21: 1111, 2100, 210x, 21x0, 1200, 120x, 12x0, where x = 1 or 2, and ten more with the two halves swapped.
		

Crossrefs

Programs

  • Maple
    A106634 := proc(n)
        local a,i,j,k,l ;
        a := 0 ;
        for i from 0 to n do
            for j from 0 to n do
                if i*j > n then
                    break;
                end if;
                for k from 0 to n do
                    if i*j = n then
                        # treat l=0 separately
                        a := a+1 ;
                    end if;
                    # l=1..n
                    if k =0 then
                        if i*j=n then
                            a := a+n ;
                        end if;
                    else
                        l := (n-i*j)/k ;
                        if l >=1 and l <=n and type(l,'integer') then
                            a := a+1 ;
                        end if;
                    end if;
                end do:
            end do:
        end do:
        a ;
    end proc: # R. J. Mathar, Oct 17 2012
  • Mathematica
    list[n_] := Module[{v, i, j}, v[_] = 0;
    For[i = 2, i <= n, i++, For[j = 1, j <= Min[Quotient[n, i], i-1], j++, v[i*j]+= 2]];
    For[i = 1, i <= Floor@Sqrt[n], i++, v[i^2]++];
    Join[{1}, Table[2 Sum[v[j] v[i-j], {j, Quotient[i, 2]+1, i-1}]+If[OddQ[i], 0, v[i/2]^2]+(4i+2) v[i], {i, 1, n}]]];
    list[48] (* Jean-François Alcover, Jun 04 2023, after Charles R Greathouse IV *)
  • PARI
    list(n)={
        my(v=vector(n));
        for(i=2,n,for(j=1,min(n\i,i-1),v[i*j]+=2));
        for(i=1,sqrtint(n),v[i^2]++);
        concat(1,vector(n,i,2*sum(j=i\2+1,i-1,v[j]*v[i-j])+if(i%2,,v[i/2]^2)+(4*i+2)*v[i]))
    }; \\ Charles R Greathouse IV, Oct 17 2012

Formula

From Ridouane Oudra, Jul 20 2024: (Start)
a(n) = (4*n + 2)*tau(n) + Sum_{i=1..n-1} tau(i)*tau(n-i), for n>0 ;
a(n) = (4*n + 2)*A000005(n) + A055507(n-1), for n>0 ;
a(n) = 4*A038040(n) + A062011(n) + A055507(n-1), for n>0. (End)

Extensions

Definition clarified by N. J. A. Sloane, Jul 07 2012
Showing 1-10 of 20 results. Next