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.

A003016 Number of occurrences of n as an entry in rows <= n of Pascal's triangle (A007318).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Or, number of occurrences of n as a binomial coefficient. [Except for 1 which occurs infinitely many times. This is the only reason for the restriction "row <= n" in the definition. Any other number can only appear in rows <= n. - M. F. Hasler, Feb 16 2023]
Sequence A138496 gives record values and where they occur. - Reinhard Zumkeller, Mar 20 2008
Singmaster conjectures that this sequence is bounded. - Michael J. Hardy, Jun 09 2025

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 93, #47.
  • C. S. Ogilvy, Tomorrow's Math. 2nd ed., Oxford Univ. Press, 1972, p. 96.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a003016 n = sum $ map (fromEnum . (== n)) $
                          concat $ take (fromInteger n + 1) a007318_tabl
    -- Reinhard Zumkeller, Apr 12 2012
    
  • Mathematica
    a[0] = 0; t = {{1}}; a[n_] := Count[ AppendTo[t, Table[ Binomial[n, k], {k, 0, n}]], n, {2}]; Table[a[n], {n, 0, 101}] (* Jean-François Alcover, Feb 20 2012 *)
  • PARI
    {A003016(n)=if(n<4, [0,3,1,2][n+1], my(c=2, k=2, r=sqrtint(2*n)+1, C=r*(r-1)/2); until(, while(C= r\2 && break; C *= r-k; C \= r; r -= 1); c)} \\ M. F. Hasler, Feb 16 2023
    
  • Python
    from math import isqrt # requires python3.8 or higher
    def A003016(n):
        if n < 4: return[0,3,1,2][n]
        cnt = k = 2; r = isqrt(2*n)+1; C = r*(r-1)//2
        while True:
           while C < n and k < r//2:
              C *= r-k; k += 1; C //= k
           if C == n: cnt += 2 - (r == 2*k)
           if k >= r//2: return cnt
           C *= r-k; C //= r; r -= 1 # M. F. Hasler, Feb 16 2023

Extensions

More terms from Erich Friedman
Edited by N. J. A. Sloane, Nov 18 2007, at the suggestion of Max Alekseyev