私はBigInteger形式で書く必要がある方程式を持っています。それはforループ内にある必要があります。これは私がこれまで行ってきたことですが、BigIntegerをどのように使用するのか分かりません。これは、forループであると記述された式である:私は(3 * iはI + 3 * I 1 *)/ 30独自の式のBigIntegerクラスをどのように実装しますか?
public static BigInteger[] nthtetranum(int n) //This is the method using the simple formula for tetra number.
{
BigInteger[] nth = new BigInteger[n];
for(int i = 0; i <nth.length; i++)
{
//nth[i] = i*(i+1)*(2*i+1)*(3*i*i+3*i-1)/30;
nth[i] =
}
return nth;
質問がありますか? – ControlAltDel
名前が 'nth'の2つの変数があります。あなたは何を達成しようとしていますか? –
申し訳ございません。私はコードを修正した。私はBigInteger形式でi *(i + 1)*(2 * i + 1)*(3 * i * i + 3 * i-1)/ 30を必要とします – Mike