格点计算器

2020-03-31 10:59张奎福
数理化解题研究 2020年9期
关键词:正点分点格点

张奎福

(吉林省松原市长岭县巨宝山镇 131533)

一、符号

[a] 不大于a的最大整数

G(r) 半径为r的圆内格点数

g(r) 半径为r的圆上格点数

x格点的横坐标

y格点的纵坐标

r∈Zr是整数

r∉Zr不是整数

∑ 求和

二、问题

Gauss(1777-1855)问题:中心在原点、半径为r的圆的内部有多少个格点?

三、格点的分类

原点:x=y=0.

分点:x2=y2≠0.

正点:x×y=0,x2≠y2.

散点:x×y≠0,x2≠y2.

四、圆上格点

x2+y2=r2.

∵x∈Z,∴x2∈Z,

∵y∈Z,∴y2∈Z,

∴x2+y2=r2∈Z.

∴当r2∉Z时,g(r)=0.

∵g(0)=1,

∴只考虑r2∈Z,r>0.

正点:当r∈Z时,有4个.

五、圆内格点

x2+y2≤r2.

∵当r2∉Z时,g(r)=0,

∴圆内格点是分层分布的,它们只在半径为r且r2∈Z的同心圆上.

原点:1.

分点:4s.

正点:4[r].

六、计算器草图

七、VB编程

Dim a, b, c, r, s, t, i, l, k

Private Sub CommandButton1_Click()

a = 0: b = 0: c = 1: r = 0: s = 0: t = 0: i = 0: k = 0: TextBox1 = ""

End Sub

Private Sub CommandButton10_Click()

If TextBox1 = 0 Then TextBox1 = "7": GoTo 10

TextBox1 = TextBox1 & "7"

10 End Sub

Private Sub CommandButton11_Click()

If TextBox1 = 0 Then TextBox1 = "8": GoTo 10

TextBox1 = TextBox1 & "8"

10 End Sub

Private Sub CommandButton12_Click()

If TextBox1 = 0 Then TextBox1 = "9": GoTo 10

TextBox1 = TextBox1 & "9"

10 End Sub

Private Sub CommandButton13_Click()

If Int(r) = r Then b = b + 4

If Sqr(a / 2) = s Then b = b + 4

For i = s + 1 To Sqr(a - 1)

k = a - i * i

If Int(Sqr(k)) = Sqr(k) Then b = b + 8

Next i

TextBox1 = b

End Sub

Private Sub CommandButton14_Click()

If TextBox1 <> 0 Then TextBox1 = TextBox1 & "0"

End Sub

Private Sub CommandButton15_Click()

For i = 1 To s:

c = c + 8 * Int(Sqr(a - i * i))

Next i

c = c + 4 * Int(r) - 4 * s * s

TextBox1 = c

End Sub

Private Sub CommandButton2_Click()

If t = 0 Then TextBox1 = TextBox1 & ".": t = 1

End Sub

Private Sub CommandButton3_Click()

a = TextBox1: r = Sqr(a): s = Int(Sqr(a / 2))

TextBox1 = r

End Sub

Private Sub CommandButton4_Click()

If TextBox1 = 0 Then TextBox1 = "1": GoTo 10

TextBox1 = TextBox1 & "1"

10 End Sub

Private Sub CommandButton5_Click()

If TextBox1 = 0 Then TextBox1 = "2": GoTo 10

TextBox1 = TextBox1 & "2"

10 End Sub

Private Sub CommandButton6_Click()

If TextBox1 = 0 Then TextBox1 = "3": GoTo 10

TextBox1 = TextBox1 & "3"

10 End Sub

Private Sub CommandButton7_Click()

If TextBox1 = 0 Then TextBox1 = "4": GoTo 10

TextBox1 = TextBox1 & "4"

10 End Sub

Private Sub CommandButton8_Click()

If TextBox1 = 0 Then TextBox1 = "5": GoTo 10

TextBox1 = TextBox1 & "5"

10 End Sub

Private Sub CommandButton9_Click()

If TextBox1 = 0 Then TextBox1 = "6": GoTo 10

TextBox1 = TextBox1 & "6"

10 End Sub

Private Sub UserForm_Click()

End Sub

八、使用说明

九、程序测试

r2,G(r).

1,5.10,37.102,317.103,3149.104,31417.105,314197.

106,3141549.107,31416025.108,314159053.109,3141592409.

1010,31415925457.1011,314159264013.1012,3141592649625.

1013,31415926532017.1014,314159265350589.

2*1014,628318530711997.3*1014,942477796083985.

318309886183721-318309886183724,1015-3.

318309886183725,1015+45.

猜你喜欢
正点分点格点
带有超二次位势无限格点上的基态行波解
一种电离层TEC格点预测模型
复杂地形的动车组正点、节能优化
格点计算器
来自低谷的你
定比分点之换底分点伸缩法
五禽戏“动作节分点”划分与学练建议(三)
正点
趣味汉字——正点和整点
格点和面积