0
import java.util.Scanner;
public class NeumannsRandomGenerator {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter cases:");
int cases = in.nextInt();
int iterations = 0;
for (int i = 0; i <= cases; i++) {
int a = in.nextInt();
int res = ((a * a)/100) % 10000;
if(res == a){
iterations++;
}
do {
int b = ((res * res)/100) % 10000;
iterations++;
b = res;
} while (a != res);
System.out.println(iterations);
}
}
}
我試圖找出Neumans隨機生成 例如:我試圖找出Neumans隨機
5761 - 讓它成爲了第一個數字
5761 * 5761 = 33189121 - 提升到功率2
33(1891)21 => 1891 - 截斷,以獲得中間
1891 - 它是序列
1891 * 1891 = 3575881中的第二個數字 - 升高到功率2(添加前導零得到8位數字)
03(5758)81 => 5758 - 截斷,以獲得中間
5758 - 這是序列中的第三個數字(等等...)
請幫助爲什麼我沒有得到任何結果:(