求一组正整数A,B,C
原题请看附件(书摘),开始以为以现代的电脑,求算A,B,C 是小菜一碟。不料试算了一阵,”牛刀杀鸡“,竟无结果。我的问题:
1.求解A^3+B^3=22*C^3有无其他直接的方法?
2.为何以现代的电脑,就算不出来?
我用的是Basic, 在Excell中走。
Sub C_Finder()
Dim c, k As Double
For i = 1 To 1000
a = i * i * i
For j = i To 1000
b = j * j * j
c = (a*a*a + b*b*b) / 22
If c = Int(c) Then
k = c ^ (1 / 3)
d = Int(k)
If d = k Then
Range("A4").Select
ActiveCell.Value = i
Range("B4").Select
ActiveCell.Value = j
Range("C4").Select
ActiveCell.Value = k
Range("D4").Select
ActiveCell.Value = "Done!"
Stop
End If
End If
Next j
Next i
Range("D2").Select
ActiveCell.Value = "Finished. Fail to find"
End Sub http://www.physicsforums.com/archive/index.php/t-8495.html
上面的链接上有一些比较有用的信息
17,299^3 + 25,469^3 = 22(9,954^3), both 17,299 and 25,469 are prime.
http://bbs.emath.ac.cn/images/common/back.gif
楼主的程序运行无解,是因为搜索范围偏小,只能表明在该范围内无解而已。
RE: 求一组正整数A,B,C
对不起各位,C的表达式应该为C=(a+b)/22。 程序中的错误, 是我放上来时,做最后的修改润色时,一时匆忙不查,改错了。 再次向各位致歉!:( 3# gxqcn谢谢提示。用下面改进后的程序走,20秒搜索到了。当初曾扩大搜索到4000,没想到应扩大搜索到26000!
Sub C_Finder()
Dim c, k As Double
Range("A1").Select
ActiveCell.Value = "I"
Range("B1").Select
ActiveCell.Value = "J"
Range("C1").Select
ActiveCell.Value = "K"
Range("D1").Select
ActiveCell.Value = "Hint"
Range("E1").Select
ActiveCell.Value = "C=(a+b)/22"
Range("F1").Select
ActiveCell.Value = "a+b"
Range("G1").Select
ActiveCell.Value = "K^3"
Range("I1").Select
ActiveCell.Value = "Starting time"
Range("I2").Select
ActiveCell.Value = Time()
l = 0
For i = 17200 To 18000
a = i * i * i
For j = 25400 To 25500
b = j * j * j
c = (a + b) / 22
If c = Int(c) Then
l = l + 1
Range("E3").Select
ActiveCell.Value = c
Range("A3").Select
ActiveCell.Value = i
Range("B3").Select
ActiveCell.Value = j
Range("F3").Select
ActiveCell.Value = a + b
Range("H2").Select
ActiveCell.Value = l
k = Int(c ^ (1 / 3)) - 1
Loop1: Range("C2").Select
ActiveCell.Value = k
d = k * k * k
Range("G2").Select
ActiveCell.Value = d
If c = d Then
Range("A4").Select
ActiveCell.Value = i
Range("B4").Select
ActiveCell.Value = j
Range("C4").Select
ActiveCell.Value = k
Range("D4").Select
ActiveCell.Value = "Done!"
Range("I3").Select
ActiveCell.Value = "Ending time"
Range("I4").Select
ActiveCell.Value = Time()
Stop
End If
If d < c Then
k = k + 1
GoTo Loop1
End If
Range("C2").Select
ActiveCell.Value = k
End If
Range("B2").Select
ActiveCell.Value = j
Next j
Range("A2").Select
ActiveCell.Value = i
Next i
Range("D2").Select
ActiveCell.Value = "Finished. Fail to find"
Range("I3").Select
ActiveCell.Value = "Ending time"
Range("I4").Select
ActiveCell.Value = Time()
End Sub 另外,VBS做数学题有点慢啊 6# 无心人
是的。稍有点份量的的计算就不能用VBS做。我是事前估计严重不足。 http://math.stackexchange.com/questions/1190385/algorithm-for-positive-integer-solutions-of-equation-a3b3-22c3 第一个解是 25469^3+ 17299^3=22*9954^3, 这个尚且能穷举出来。
第二个解是 (-661146496267328783)^3+ 684469533791312783^3 = 22*112919729369578740^3
这就不可能穷举了
第三个解是14176649488890906071282308630139700149971^3+ 2524900422828984578915633878895046291581^3= 22*5068914033007802762941623871038239169306^3
这个问题可以对应到椭圆曲线y^2=x^3-3267, 有无穷多个整数解。
页:
[1]