mathe 发表于 2008-1-21 15:24:35

均匀的平方数

非常好的课题11826×11826=139854276
其中数字1-9都正好在平方数中出现过一次
请找出数字1-9都正好出现两次,三次的平方数
如果是立方数呢?

gxqcn 发表于 2008-1-21 16:03:10

楼主这个话题非常好,
我找到一些资料给大家分享:http://mathworld.wolfram.com/SquareNumber.html

The smallest and largest square numbers containing the digits 1 to 9 are

    118262 = 139854276
    303842 = 923187456

The smallest and largest square numbers containing the digits 0 to 9 are

    320432 = 1026753849
    990662 = 9814072356

(Madachy 1979, p. 159).

The smallest and largest square numbers containing the digits 1 to 9 twice each are

    3351801362 = 112345723568978496
    9993904322 = 998781235573146624

and the smallest and largest containing 1 to 9 three times are

    105462001953122 = 111222338559598866946777344
    316210178081822 = 999888767225363175346145124

(Madachy 1979, p. 159).

  该页还介绍仅由 1, 4, and 9 组成的完全平方数,当前已知的最大的为(found by G. Jacobson and D. Applegate):
    6480702115891070212 = 419994999149149944149149944191494441

  如果谁有兴趣,不妨编程寻找全部(或部分)的“均匀平方数”,甚或“均匀立方数”。。。兴许会创造一项新的世界纪录呢!:)

(将该帖置顶,欢迎大家各显神通,对有突破者可重奖!)

northwolves 发表于 2008-1-22 16:36:55

Another Link:
http://www.asahi-net.or.jp/~KC2H-MSM/mathland/math02/math0210.htm

northwolves 发表于 2008-1-22 19:37:35

数字1-9都正好在平方数中出现过一次:

11826^2=139854276
12363^2=152843769
12543^2=157326849
14676^2=215384976
15681^2=245893761
15963^2=254817369
18072^2=326597184
19023^2=361874529
19377^2=375468129
19569^2=382945761
19629^2=385297641
20316^2=412739856
22887^2=523814769
23019^2=529874361
23178^2=537219684
23439^2=549386721
24237^2=587432169
24276^2=589324176
24441^2=597362481
24807^2=615387249
25059^2=627953481
25572^2=653927184
25941^2=672935481
26409^2=697435281
26733^2=714653289
27129^2=735982641
27273^2=743816529
29034^2=842973156
29106^2=847159236
30384^2=923187456

northwolves 发表于 2008-1-22 20:01:39

数字1-9都正好在立方数中出现过2次:
496536^3=122419957378438656
524583^3=144358591927663287
536916^3=154781495378623296
569013^3=184232635967485197
620049^3=238384511265977649
645393^3=268826917394513457
650976^3=275863938452914176
657756^3=284573499861537216
659517^3=286865277399541413
690537^3=329276594178684153
693114^3=332976829178165544
704688^3=349937615452188672
712863^3=362258197485319647
735495^3=397868149526412375
751923^3=425128389951367467
801948^3=515749274681683392
806559^3=524696811325734879
807423^3=526384811243795967
840303^3=593345621786498127
849912^3=613934279746518528
982617^3=948752253468679113

northwolves 发表于 2008-1-22 20:55:21

连4次方的都有了数字1-9都正好在4次方数中出现过2次:

24267^4=346788239145769521

数字1-9都正好在4次方数中出现过3次:

3374532^4=129674386889412754339512576
3928791^4=238251533697271448899465761
4143474^4=294753161557948842361832976
4552878^4=429678924211358816933757456
4714896^4=494183761229357362781945856
4796571^4=529326344785614297819357681
4905006^4=578839516184244753637921296
5577408^4=967675311854837821442359296

gxqcn 发表于 2008-1-23 08:44:07

northwolves 太厉害了!

可否说说你是如何做到的?

gxqcn 发表于 2008-1-24 07:53:09

为什么不是 0~9 呢?

既然讲求均匀,为何要排除“0”呢?如果纳入“0”结果会怎样呢?

(这类问题是与我们计数法则密切相关的,它体现了数学的奇异美。)

northwolves 发表于 2008-1-24 17:18:59

我的做法比较简单,用EXCEL VBA写了一个宏,吃晚饭前运行上,吃完饭过来看结果:

Sub Macro1()
Dim i As Long, j As Byte, result As String, b As Boolean, s() As String
For i = 335180136 To 999390432 Step 3
result = Left(i ^ 2, 15) & Right((i Mod 10000) ^ 2, 4)
If InStr(result, 0) = 0 Then
b = True
For j = 1 To 9
If Len(Replace(result, j, "")) <> 17 Then b = False: Exit Sub
Next
If b = True Then n = n + 1: ReDim Preserve s(1 To n): s(n) = i & "^3=" & result
End If
Next
Open "d:\xxxxx.txt" For Binary As #1
Put #1, , Join(s, vbCrLf)
Close #1
MsgBox "ok"
End Sub

VBA精度达不到10^17,以上代码效率太低,恭候两位大哥出招.

mathe 发表于 2008-1-24 17:33:47

虽然效率不高,但是实现起来的确方便很多:)
如果用C语言写,计算包含1-9都两次的数,用64位整数(long long)来表示就可以了,没有什么特别的难度。
不过1-9三次可能就有些问题了,更加大些看来可能就很难遍历了。
不过实在没有想到结果会有这么多:)
页: [1] 2
查看完整版本: 均匀的平方数