In mathematics,   Faulhaber's formula,   named after Johann Faulhaber,   expresses the sum of the p-th powers of the first n positive integers as a (p + 1)th-degree polynomial function of n,   the coefficients involving Bernoulli numbers.



Task

Generate the first 10 closed-form expressions, starting with p = 0.



Related tasks

   Bernoulli numbers.
   evaluate binomial coefficients.


See also

   The Wikipedia entry:   Faulhaber's formula.
   The Wikipedia entry:   Bernoulli numbers.
   The Wikipedia entry:   binomial coefficients.


var [const] BN=Import("zklBigNum");	// libGMP (GNU MP Bignum Library)
 
fcn faulhaberFormula(p){  //-->(Rational,Rational...)
   [p..0,-1].pump(List(),'wrap(k){ B(k)*BN(p+1).binomial(k) })
   .apply('*(Rational(1,p+1)))
}