Balanced Binomial Coefficient

Author

Eric W. Weisstein
April 15, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Combinatorics/BalancedBinomialCoefficient.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/BalancedBinomialCoefficient.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Code

BalancedBinomialQ[n_,p_]:=Module[{k},
Count[#,1]==Count[#,-1]&[
JacobiSymbol[#,p]&/@Select[Mod[Table[Binomial[n,k],{k,0,n}],p],!Developer`ZeroQ[#]&]
]
]

BalancedBinomialSet[p_]:=Module[{k},
Position[Table[BalancedBinomialQ[k,p],{k,p-1}],True]//Flatten
]

Enumeration

BalancedBinomialSet[2]

Table[{#,BalancedBinomialSet[#]}&[Prime[n]],{n,2,10}]//ColumnForm

BalancedBinomialSet/@Prime/@Range[2,20]