p^n + s^n = q^n + r^n
n < 5 なら、すぐ解が見つかる。
(1..11).each{|d|
(2..4).each{|m|
flag = true
n = 2
a = n ** m + (n + d) ** m
while flag
x = 1
b = a - x ** m
y = (b ** (1.0 / m)).round
while !(y ** m == b) && x < n - 1
x += 1
b = a - x ** m
y = (b ** (1.0 / m)).round
end
if y ** m == b
p [m, d, [n, n + d, x, y]]
flag = false
break
end
n += 1
a = n ** m + (n + d) ** m
end
}
}
出力結果
[2, 1, [6, 7, 2, 9]]
[3, 1, [9, 10, 1, 12]]
[4, 1, [133, 134, 59, 158]]
[2, 2, [7, 9, 3, 11]]
[3, 2, [18, 20, 2, 24]]
[4, 2, [266, 268, 118, 316]]
[2, 3, [4, 7, 1, 8]]
[3, 3, [27, 30, 3, 36]]
[4, 3, [399, 402, 177, 474]]
[2, 4, [7, 11, 1, 13]]
[3, 4, [36, 40, 4, 48]]
[4, 4, [532, 536, 236, 632]]
[2, 5, [5, 10, 2, 11]]
[3, 5, [19, 24, 10, 27]]
[4, 5, [665, 670, 295, 790]]
[2, 6, [8, 14, 2, 16]]
[3, 6, [9, 15, 2, 16]]
[4, 6, [798, 804, 354, 948]]
[2, 7, [6, 13, 3, 14]]
[3, 7, [51, 58, 30, 67]]
[4, 7, [931, 938, 413, 1106]]
[2, 8, [9, 17, 3, 19]]
[3, 8, [72, 80, 8, 96]]
[4, 8, [1064, 1072, 472, 1264]]
[2, 9, [7, 16, 4, 17]]
[3, 9, [81, 90, 9, 108]]
[4, 9, [1197, 1206, 531, 1422]]
[2, 10, [9, 19, 1, 21]]
[3, 10, [26, 36, 17, 39]]
[4, 10, [1330, 1340, 590, 1580]]
[2, 11, [6, 17, 1, 18]]
[3, 11, [64, 75, 51, 82]]
[4, 11, [1463, 1474, 649, 1738]]
n = 5, p < 525000, q = p + 1 のときを
2日以上かけて全て調べたが解はなかった。
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。