0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

「フェルマーの二平方和定理の応用」を参考に、wolframalphaとvbaでやってみた。

Last updated at Posted at 2022-05-14

オリジナル

x^2+y^2=1105

wolfram alphaで

Result
1

Integer solutions
x = ± 33, y = ± 4
x = ± 32, y = ± 9
x = ± 31, y = ± 12
つづく

Integer solutions
x = 4, y = 33
x = 9, y = 32
x = 12, y = 31
x = 23, y = 24
x = 24, y = 23
x = 31, y = 12
x = 32, y = 9
x = 33, y = 4

vbaで

Sub aaa_main()
nMax = 1105
ActiveSheet.Cells.Clear
MsgBox "実行を開始します"
iR = 0
For i = 1 To nMax
For j = 1 To nMax
    If i ^ 2 + j ^ 2 = nMax Then
       iR = iR + 1
       Cells(iR, 1) = i
       Cells(iR, 2) = j
    End If
Next
Next
End Sub
' 4  33
' 9  32
'12  31
'23  24
'24  23
'31  12
'32   9
'33   4

よく似た問題

参考

フェルマーの二平方定理、あるいは単にフェルマーの定理 <

1101 から 1200 までの数 >

1105は2つの平方数の和として4 通り表せる最小の数です:
1105 = 4^2 + 33^2 = 9^2 + 32^2 = 12^2 + 31^2 = 23^2 + 24^2

1105は4 組の原始ピタゴラス数の最小の斜辺です:
1105^2 = 47^2 + 1104^2 = 264^2 + 1073^2 = 576^2 + 943^2 = 744^2 + 817^2

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?