var d = "";
var c = 0;
var x;
var n;
for (x = 0; x < 100000; x ++) {
n = Math.sqrt(x + 100);
if (n.toString().split(".").length == 1) {
m = Math.sqrt(x + 100 + 168);
if (m.toString().split(".").length == 1) {
c += 1;
d += x + "<br>";
console.log(c);
}
}
}
document.getElementById("demo").innerHTML = d;
</script>{:5_90:} int a = 100000;
int i = 1;
while(i<= a) {
int x = (int)Math.sqrt(i+100);
int y = (int)Math.sqrt(i+268);
if((i+100==x*x) && (i+268==y*y)){
System.out.println(i);
}
i++;
} {:5_102:} for (var x = 0; x <= 10000; x++) {
for (var y = 1; y < 100; y++) {
if (Math.sqrt(x + 100) == y) {
for (var z = 1; z < 100; z++) {
if (Math.sqrt(x + 268) == z) {
console.log("x="+x+"\t"+"y="+y+"\t"+"z="+z);
}
}
}
}
}
x=21 y=11 z=17
x=261 y=19 z=23
x=1581y=41 z=43
. 我要吐了 666 1
1
学习下 1 没看懂{:10_277:} 本帖最后由 tommyyu 于 2023-1-14 18:25 编辑
x + 100 = y*y
x + 268 = z*z
得
z*z - y*y = (z+y)(z-y)
= 268-100
= 168
= 1 * 168 -> X
= 2 * 84 -> y = 41, z = 43, x = 1581
= 3 * 56 -> X
= 4 * 42 -> y = 19, z = 23, x = 261
= 6 * 28 -> y = 11, z = 17, x = 21
= 7 * 24 -> X
= 8 * 21 -> X
= 12 * 14 -> y = 1, z = 13, x = -99 -> X
得
x = 1581或261或21 看看
页:
1
[2]