|
|
A003016
|
|
Number of occurrences of n as an entry in rows <= n of Pascal's triangle (A007318).
(Formerly M0227)
|
|
17
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
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]
|
|
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).
|
|
LINKS
|
|
|
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 *)
|
|
PROG
|
(Haskell)
a003016 n = sum $ map (fromEnum . (== n)) $
concat $ take (fromInteger n + 1) a007318_tabl
(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<n && k<r\2, C *= r-k; k += 1; C \= k); C == n && c += 2-(r == 2*k); k >= 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
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,nice,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|