无心人
发表于 2009-2-26 11:13:05
20很可能也是10的归宿
所以可以考虑4478976的分解
无心人
发表于 2009-2-26 11:13:43
haskell算10
很困难了
估计要几个小时
11
可能就要以天记了
无心人
发表于 2009-2-26 11:14:36
下面就要换C语言了
预先初始化个表
到1000万的数据均存储下来
无心人
发表于 2009-2-26 11:15:00
当然存储10^8的也可以的
mathe
发表于 2009-2-26 11:15:59
prodd n = foldr1 (*)
count n
|0<=n&&n<=9 = 0
|otherwise = (1+ count (prodd n))
smallfac n
|n==1 = True
|(mod n 2)==0 = smallfac (div n 2)
|(mod n 3)==0 = smallfac (div n 3)
|(mod n 5)==0 = smallfac (div n 5)
|(mod n 7)==0 = smallfac (div n 7)
|otherwise = False
mathe
发表于 2009-2-26 11:16:57
*Main> , count c==2, smallfac c]
[25,27,28,35,36,45,48,54,56,63,64,72,84,125,126,128,135,144,162,192,216,224,225,
243,245,250,252,256,270,280,315,324,350,360,375,405,432,441,450,480,504,512,525,
540,560,567,576,588,625,630,640,675,720,735,756,840,945,1029,1125,1134,1152,1176
,1215,1225,1250,1260,1280,1296,1323,1350,1372,1440,1458,1512,1536,1568,1620,1728
,1920,2016,2025,2058,2160,2187,2205,2240,2250,2304,2352,2430,2450,2500,2520,2560
,2592,2625,2700,2800,2835,2916,3024,3072,3125,3150,3240,3402,3500,3528,3600,3750
,4032,4050,4116,4320,4375,4410,4500,4704,4800,5040,5103,5120,5145,5184,5250,5292
,5400,5600,5625,5670,5760,5832,5880,6075,6125,6250,6300,6400,6561,6615,6750,6912
,7056,7200,7203,7350,7560,8400,8505,8575,9216,9261,9450]
mathe
发表于 2009-2-26 11:21:21
不过接下去构造也挺麻烦,比如25可以生成55,155,515,551,1155等等,当然它们大部分不合法(比如55含因子11)
看来一定要用c来构造了,haskell很难处理这么复杂的东西了
无心人
发表于 2009-2-26 11:22:34
要删除中间带0的
无心人
发表于 2009-2-26 11:23:11
不是, haskell最适合处理这个了
但你不会,呵呵
mathe
发表于 2009-2-26 11:26:35
count==2的时候可以带0的(只要带0就肯定count==2),但是后面就都不允许了。
当然如果象你那样定义,可以少很多
页:
1
2
3
4
[5]
6
7
8
9
10
11
12
13
14