JSFiddle - React, Tailwind, and code Playground

by RichardAD

HTML

<title>Big Int Power Sum</title>
<body>
Let's try this
</body>

JavaScript

function S(n,p) {
  let sum = BigInt(0);
  for (let index = BigInt(1); index <= BigInt(n); index++)
  {
  	let term = index ** BigInt(p);
    sum += term;
  }
  
  return sum;
}

function biPOW(n,p) {
	return BigInt(n) ** BigInt(p);
}


function PM(p) {
  arr = new Array (p+1);
  
  for (let index = 1; index <= p+1; index++) {
  	row = new Array(p+3);
    for (let col = 1; col <= p+1; col++) {
      row[col] = biPOW(index,col);
    }
    
    if ( index > 1 ) {
    	row[]
    } else {
      row[p]
    }
    
    arr[index] = row;    
  }
  
  return arr;
}

console.log(S(4,4));