fork download
  1. function calculateBellNumbers(n, p) {
  2. let k = 0;
  3. for (let i = 1; i <= n; i++) {
  4. let fact = i;
  5. while (fact) {
  6. fact = Math.floor(fact / p);
  7. k += fact;
  8. }
  9. }
  10. return k;
  11. }
  12.  
Success #stdin #stdout 0.02s 16784KB
stdin
Standard input is empty
stdout
Standard output is empty