ysr 发表于 2023-3-3 14:21

三角数不定方程的通解公式的验证

本帖最后由 ysr 于 2023-3-3 07:25 编辑

三角^2
数方程为:
x(x+1)+y(y+1)=z(z+1)

待验证的公式:
x=r
y=s
z=r+s+t
r=m^2-n^2
s=m^2+n^2
t<=1-r
c=2(rs+rt+st)+t^2

其中t<0,t的绝对值小于r

当z和c均大于0时就是方程的解,程序结果如下:
输入:100,就是n小于等于100
结果:
x = 3 y=5 c=2 z=6 t= -2
x = 5 y=13 c=2 z=14 t= -4
x = 7 y=25 c=2 z=26 t= -6
x = 9 y=41 c=2 z=42 t= -8
x = 11 y=61 c=2 z=62 t= -10
x = 13 y=85 c=2 z=86 t= -12
x = 15 y=113 c=2 z=114 t= -14
x = 17 y=145 c=2 z=146 t= -16
x = 19 y=181 c=2 z=182 t= -18
x = 21 y=221 c=2 z=222 t= -20
x = 23 y=265 c=2 z=266 t= -22
x = 25 y=313 c=2 z=314 t= -24
x = 27 y=365 c=2 z=366 t= -26
x = 29 y=421 c=2 z=422 t= -28
x = 31 y=481 c=2 z=482 t= -30
x = 33 y=545 c=2 z=546 t= -32
x = 35 y=613 c=2 z=614 t= -34
x = 37 y=685 c=2 z=686 t= -36
x = 39 y=761 c=2 z=762 t= -38
x = 41 y=841 c=2 z=842 t= -40
x = 43 y=925 c=2 z=926 t= -42
x = 45 y=1013 c=2 z=1014 t= -44
x = 47 y=1105 c=2 z=1106 t= -46
x = 49 y=1201 c=2 z=1202 t= -48
x = 51 y=1301 c=2 z=1302 t= -50
x = 53 y=1405 c=2 z=1406 t= -52
x = 55 y=1513 c=2 z=1514 t= -54
x = 57 y=1625 c=2 z=1626 t= -56
x = 59 y=1741 c=2 z=1742 t= -58
x = 61 y=1861 c=2 z=1862 t= -60
x = 63 y=1985 c=2 z=1986 t= -62
x = 65 y=2113 c=2 z=2114 t= -64
x = 67 y=2245 c=2 z=2246 t= -66
x = 69 y=2381 c=2 z=2382 t= -68
x = 71 y=2521 c=2 z=2522 t= -70
x = 73 y=2665 c=2 z=2666 t= -72
x = 75 y=2813 c=2 z=2814 t= -74
x = 77 y=2965 c=2 z=2966 t= -76
x = 79 y=3121 c=2 z=3122 t= -78
x = 81 y=3281 c=2 z=3282 t= -80
x = 83 y=3445 c=2 z=3446 t= -82
x = 85 y=3613 c=2 z=3614 t= -84
x = 87 y=3785 c=2 z=3786 t= -86
x = 89 y=3961 c=2 z=3962 t= -88
x = 91 y=4141 c=2 z=4142 t= -90
x = 93 y=4325 c=2 z=4326 t= -92
x = 95 y=4513 c=2 z=4514 t= -94
x = 97 y=4705 c=2 z=4706 t= -96
x = 99 y=4901 c=2 z=4902 t= -98
x = 101 y=5101 c=2 z=5102 t= -100
x = 103 y=5305 c=2 z=5306 t= -102
x = 105 y=5513 c=2 z=5514 t= -104
x = 107 y=5725 c=2 z=5726 t= -106
x = 109 y=5941 c=2 z=5942 t= -108
x = 111 y=6161 c=2 z=6162 t= -110
x = 113 y=6385 c=2 z=6386 t= -112
x = 115 y=6613 c=2 z=6614 t= -114
x = 117 y=6845 c=2 z=6846 t= -116
x = 119 y=7081 c=2 z=7082 t= -118
x = 121 y=7321 c=2 z=7322 t= -120
x = 123 y=7565 c=2 z=7566 t= -122
x = 125 y=7813 c=2 z=7814 t= -124
x = 127 y=8065 c=2 z=8066 t= -126
x = 129 y=8321 c=2 z=8322 t= -128
x = 131 y=8581 c=2 z=8582 t= -130
x = 133 y=8845 c=2 z=8846 t= -132
x = 135 y=9113 c=2 z=9114 t= -134
x = 137 y=9385 c=2 z=9386 t= -136
x = 139 y=9661 c=2 z=9662 t= -138
x = 141 y=9941 c=2 z=9942 t= -140
x = 143 y=10225 c=2 z=10226 t= -142
x = 145 y=10513 c=2 z=10514 t= -144
x = 147 y=10805 c=2 z=10806 t= -146
x = 149 y=11101 c=2 z=11102 t= -148
x = 151 y=11401 c=2 z=11402 t= -150
x = 153 y=11705 c=2 z=11706 t= -152
x = 155 y=12013 c=2 z=12014 t= -154
x = 157 y=12325 c=2 z=12326 t= -156
x = 159 y=12641 c=2 z=12642 t= -158
x = 161 y=12961 c=2 z=12962 t= -160
x = 163 y=13285 c=2 z=13286 t= -162
x = 165 y=13613 c=2 z=13614 t= -164
x = 167 y=13945 c=2 z=13946 t= -166
x = 169 y=14281 c=2 z=14282 t= -168
x = 171 y=14621 c=2 z=14622 t= -170
x = 173 y=14965 c=2 z=14966 t= -172
x = 175 y=15313 c=2 z=15314 t= -174
x = 177 y=15665 c=2 z=15666 t= -176
x = 179 y=16021 c=2 z=16022 t= -178
x = 181 y=16381 c=2 z=16382 t= -180
x = 183 y=16745 c=2 z=16746 t= -182
x = 185 y=17113 c=2 z=17114 t= -184
x = 187 y=17485 c=2 z=17486 t= -186
x = 189 y=17861 c=2 z=17862 t= -188
x = 191 y=18241 c=2 z=18242 t= -190
x = 193 y=18625 c=2 z=18626 t= -192
x = 195 y=19013 c=2 z=19014 t= -194
x = 197 y=19405 c=2 z=19406 t= -196
x = 199 y=19801 c=2 z=19802 t= -198

代码如下:

Private Sub Command1_Click()
Dim m, n, x, y, z
a = Val(Text1)
n = 1
Do While n <= a
m = Val(n + 1)
Do While m <= a
r = Val(m ^ 2 - n ^ 2)
t = Val(1 - r)
Do While Abs(t) < r
s = Val(m ^ 2 + n ^ 2)
x = r
y = s
c = Val(2 * (r * s + r * t + s * t) + t ^ 2)
z = Val(r + s + t)
If Val(c) > 0 And Val(z) > 0 Then
s2 = Val(s2 + 1)
s1 = s1 & "x = " & x & " y=" & y & " c=" & c & " z=" & z & " t= " & t & vbCrLf
Else
s2 = s2
End If


t = Val(t - 1)
Loop


m = Val(m + 1)
Loop
n = Val(n + 1)
Loop

If s2 > 0 Then
Text2 = s1
Else
Text2 = "wu   jie"
End If


End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
End Sub

Treenewbee 发表于 2023-3-3 14:36

\[(x,y,z)=(2n+1,2n^2+3n,2n^2+3n+1)\]

ysr 发表于 2023-3-3 15:00

除了一楼的第一组解以外其他都不是原方程的解,公式待解,问题没有解决。

ysr 发表于 2023-3-3 15:31

如下为利用T先生的公式,得到的100组解:
x=3y=5z=6
x=5y=14z=15
x=7y=27z=28
x=9y=44z=45
x=11y=65z=66
x=13y=90z=91
x=15y=119z=120
x=17y=152z=153
x=19y=189z=190
x=21y=230z=231
x=23y=275z=276
x=25y=324z=325
x=27y=377z=378
x=29y=434z=435
x=31y=495z=496
x=33y=560z=561
x=35y=629z=630
x=37y=702z=703
x=39y=779z=780
x=41y=860z=861
x=43y=945z=946
x=45y=1034z=1035
x=47y=1127z=1128
x=49y=1224z=1225
x=51y=1325z=1326
x=53y=1430z=1431
x=55y=1539z=1540
x=57y=1652z=1653
x=59y=1769z=1770
x=61y=1890z=1891
x=63y=2015z=2016
x=65y=2144z=2145
x=67y=2277z=2278
x=69y=2414z=2415
x=71y=2555z=2556
x=73y=2700z=2701
x=75y=2849z=2850
x=77y=3002z=3003
x=79y=3159z=3160
x=81y=3320z=3321
x=83y=3485z=3486
x=85y=3654z=3655
x=87y=3827z=3828
x=89y=4004z=4005
x=91y=4185z=4186
x=93y=4370z=4371
x=95y=4559z=4560
x=97y=4752z=4753
x=99y=4949z=4950
x=101y=5150z=5151
x=103y=5355z=5356
x=105y=5564z=5565
x=107y=5777z=5778
x=109y=5994z=5995
x=111y=6215z=6216
x=113y=6440z=6441
x=115y=6669z=6670
x=117y=6902z=6903
x=119y=7139z=7140
x=121y=7380z=7381
x=123y=7625z=7626
x=125y=7874z=7875
x=127y=8127z=8128
x=129y=8384z=8385
x=131y=8645z=8646
x=133y=8910z=8911
x=135y=9179z=9180
x=137y=9452z=9453
x=139y=9729z=9730
x=141y=10010z=10011
x=143y=10295z=10296
x=145y=10584z=10585
x=147y=10877z=10878
x=149y=11174z=11175
x=151y=11475z=11476
x=153y=11780z=11781
x=155y=12089z=12090
x=157y=12402z=12403
x=159y=12719z=12720
x=161y=13040z=13041
x=163y=13365z=13366
x=165y=13694z=13695
x=167y=14027z=14028
x=169y=14364z=14365
x=171y=14705z=14706
x=173y=15050z=15051
x=175y=15399z=15400
x=177y=15752z=15753
x=179y=16109z=16110
x=181y=16470z=16471
x=183y=16835z=16836
x=185y=17204z=17205
x=187y=17577z=17578
x=189y=17954z=17955
x=191y=18335z=18336
x=193y=18720z=18721
x=195y=19109z=19110
x=197y=19502z=19503
x=199y=19899z=19900
x=201y=20300z=20301

Treenewbee 发表于 2023-3-3 15:50

Treenewbee 发表于 2023-3-3 14:36
\[(x,y,z)=(2n+1,2n^2+3n,2n^2+3n+1)\]

这是你的一楼的数据的通解

Treenewbee 发表于 2023-3-3 16:04

\的通解就是
\ 是合数

Treenewbee 发表于 2023-3-3 16:08

比如,\+1\] 一定是可以找到解的

ysr 发表于 2023-3-3 16:09

本帖最后由 ysr 于 2023-3-4 21:29 编辑

偶数的情况,得到10组解:
x=4y=9z=10
x=6y=20z=21
x=8y=35z=36
x=10y=54z=55
x=12y=77z=78
x=14y=104z=105
x=16y=135z=136
x=18y=170z=171
x=20y=209z=210
x=22y=252z=253
公式是:
x = 2 * n + 2
y = 2 * (n + 1) ^ 2 + n
z = 2 * (n + 1) ^ 2 + n + 1
代码如下:
Private Sub Command1_Click()
'代码为x是偶数的解,存一下吧
Dim p, q, x, y, z
A = Val(Text1)
n = 1
Do While Val(n) <= A

x = 2 * n + 2
y = 2 * (n + 1) ^ 2 + n
z = 2 * (n + 1) ^ 2 + n + 1


If y > 0 And z > 0 Then
s2 = s2 + 1
s1 = s1 & "x=" & x & "y=" & y & "z=" & z & vbCrLf
Else
s2 = s2
End If

n = n + 1
Loop


If Val(s2) > 0 Then
Text2 = s1
Else
Text2 = "wu   jie"
End If


End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
End Sub

Private Sub Command1_Click()
'代码为x是奇数的解,存一下吧
Dim p, q, x, y, z
A = Val(Text1)
n = 1
Do While Val(n) <= A

x = 2 * n + 1
y = 2 * n ^ 2 + 3 * n
z = 2 * n ^ 2 + 3 * n + 1


If y > 0 And z > 0 Then
s2 = s2 + 1
s1 = s1 & "x=" & x & "y=" & y & "z=" & z & vbCrLf
Else
s2 = s2
End If

n = n + 1
Loop


If Val(s2) > 0 Then
Text2 = s1
Else
Text2 = "wu   jie"
End If


End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
End Sub

Treenewbee 发表于 2023-3-3 16:26

或者 \\]

或者 \\]

Treenewbee 发表于 2023-3-3 16:30

参考 A012132                Numbers z such that x*(x+1) + y*(y+1) = z*(z+1) is solvable in positive integers x,y.
页: [1] 2 3 4
查看完整版本: 三角数不定方程的通解公式的验证