gxqcn
发表于 2009-3-9 21:17:51
原帖由 mathe 于 2009-3-9 21:12 发表 http://bbs.emath.ac.cn/images/common/back.gif
(%i6) primep(8*5+1);(%o6) true(%i7) primep(2*3*7*11*13*29*31*37+1);(%o7) true
(%i9) primep(4*7+1);(%o9) true(%i10) primep(4*3*5*11*13*29*31*37+1);(%o10) true
(%i29) primep(4*37+1);(%o29) true(%i30)...
不懂这种语法,
请以第一行为例给我们讲解一下,扫扫盲。。。
mathe
发表于 2009-3-9 21:35:12
(%i6)是maxima的提示符
然后我输入primep(8*5+1)用来判断8*5+1是否素数。
而maxima下的换行符贴过来好像没了,所以没有显示换行。
接下去(%o6)true是maxima的输出,表示上面的计算结果是true,也就是8*5+1是素数。
当然中间还有i8等结果是false的判断,我没有贴出来
kofeffect
发表于 2009-3-9 23:14:55
{7,11,59}
{3,31,59}
{2,61,59}
{7,13,71}
{5,19,71}
{3,37,71}
{2,73,71}
{7,41,239}
{5,61,239}
{2,241,239}
{7,53,311}
{5,79,311}
{3,157,311}
{2,313,311}
{11,37,359}
{7,61,359}
{3,181,359}
{7,71,419}
{3,211,419}
{2,421,419}
{13,37,431}
{7,73,431}
{5,109,431}
{2,433,431}
{17,31,479}
{13,41,479}
{3,241,479}
{19,29,503}
{13,43,503}
{5,127,503}
{11,61,599}
{7,101,599}
{5,151,599}
{19,37,647}
{7,109,647}
{5,163,647}
{23,31,659}
{11,67,659}
{3,331,659}
{19,41,719}
{13,61,719}
{11,73,719}
{5,181,719}
{13,71,839}
{5,211,839}
{3,421,839}
{17,73,1151}
{13,97,1151}
{7,193,1151}
{31,43,1259}
{19,71,1259}
{11,127,1259}
{7,211,1259}
{23,73,1583}
{19,89,1583}
{5,397,1583}
{31,67,1979}
{11,199,1979}
{7,331,1979}
{37,59,2087}
{7,349,2087}
{5,523,2087}
{41,61,2399}
{17,151,2399}
{11,241,2399}
{7,401,2399}
{37,73,2591}
{17,163,2591}
{7,433,2591}
{41,73,2879}
{31,97,2879}
{17,181,2879}
{13,241,2879}
{41,79,3119}
{11,313,3119}
{7,521,3119}
{17,211,3359}
{13,281,3359}
{11,337,3359}
{31,127,3779}
{19,211,3779}
{11,379,3779}
{41,103,4079}
{31,137,4079}
{11,409,4079}
{61,79,4679}
{37,131,4679}
{31,157,4679}
{47,109,4967}
{37,139,4967}
{19,277,4967}
{71,73,5039}
{41,127,5039}
{29,181,5039}
{19,281,5039}
{13,421,5039}
{61,89,5279}
{23,241,5279}
{17,331,5279}
{31,197,5879}
{29,211,5879}
{13,491,5879}
{31,199,5939}
{23,271,5939}
{19,331,5939}
{59,109,6263}
{19,349,6263}
{13,523,6263}
{71,97,6719}
{61,113,6719}
{29,241,6719}
{17,421,6719}
{73,97,6911}
{37,193,6911}
{17,433,6911}
{67,109,7127}
{37,199,7127}
{19,397,7127}
{71,109,7559}
{61,127,7559}
{43,181,7559}
{37,211,7559}
{29,271,7559}
{19,421,7559}
{71,127,8819}
{43,211,8819}
{19,491,8819}
{101,109,10799}
{73,151,10799}
{61,181,10799}
{41,271,10799}
{97,131,12479}
{53,241,12479}
{41,313,12479}
{67,211,13859}
{43,331,13859}
{31,463,13859}
{79,241,18719}
{61,313,18719}
{37,521,18719}
{71,277,19319}
{47,421,19319}
{43,461,19319}
{79,281,21839}
{71,313,21839}
{53,421,21839}
{43,521,21839}
{127,181,22679}
{109,211,22679}
{61,379,22679}
{113,241,26879}
{97,281,26879}
{61,449,26879}
{137,199,26927}
{89,307,26927}
{67,409,26927}
{137,211,28559}
{103,281,28559}
{71,409,28559}
{151,197,29399}
{71,421,29399}
{61,491,29399}
{163,211,34019}
{127,271,34019}
{71,487,34019}
{181,197,35279}
{127,281,35279}
{73,491,35279}
{127,353,44351}
{113,397,44351}
{97,463,44351}
{197,271,52919}
{127,421,52919}
{109,491,52919}
{211,313,65519}
{157,421,65519}
{127,521,65519}
{281,337,94079}
{211,449,94079}
{193,491,94079}
{331,337,110879}
{281,397,110879}
{241,463,110879}
mathe
发表于 2009-3-10 08:25:53
Kofeffect是用穷举的方法?
无心人
发表于 2009-3-10 08:55:03
2的23
3的59
4的71
5的5039
6的7559
medie2005
发表于 2009-3-10 09:11:04
呵呵,那就再求7到10的吧.
kofeffect
发表于 2009-3-10 10:18:43
原帖由 mathe 于 2009-3-10 08:25 发表 http://bbs.emath.ac.cn/images/common/back.gif
Kofeffect是用穷举的方法?
看出来了啊,呵呵。
无心人
发表于 2009-3-10 10:35:12
似乎kofeffect求的不对
看我的结果
import Primes
import List
main = do
let a = sort [(r, p, q) | p <- primesTo10000, q <- primesTo10000, q > p, let r = p * q - (p + q), isPrime r]
let b = map (\l -> (head l, length l))\$ group \$ map (\(r, _, _) -> r) a
let c = nub \$ sort \$ map (\(_, l) -> l) b
let maxc = maximum c
print maxc
let d = [(n, l) | n <- , let hds = filter (\(_, l) -> l == n) b, not (null hds), let hd = fst \$ head hds,let l = filter (\(r, _, _) -> r == hd) a]
print \$ show d
=============================================================================
输出
"[(1,[(3,2,5)]),(2,[(11,2,13),(11,3,7)]),(3,[(59,2,61),(59,3,31),(59,7,11)]),(4,[(71,2,73),(71,3,37),(71,5,19),(71,7,13)]),(5,[
1151,2,1153),(1151,3,577),(1151,7,193),(1151,13,97),(1151,17,73)]),(6,[(2399,3,1201),(2399,5,601),(2399,7,401),(2399,11,241),(2
99,17,151),(2399,41,61)]),(7,[(9719,2,9721),(9719,3,4861),(9719,7,1621),(9719,13,811),(9719,19,541),(9719,37,271),(9719,61,163)
),(8,[(19319,3,9661),(19319,5,4831),(19319,7,3221),(19319,11,1933),(19319,29,691),(19319,43,461),(19319,47,421),(19319,71,277)]
,(9,[(7559,2,7561),(7559,11,757),(7559,13,631),(7559,19,421),(7559,29,271),(7559,37,211),(7559,43,181),(7559,61,127),(7559,71,1
9)]),(10,[(166319,19,9241),(166319,23,7561),(166319,37,4621),(166319,41,4159),(166319,67,2521),(166319,71,2377),(166319,73,2311
,(166319,127,1321),(166319,271,617),(166319,397,421)]),(11,[(347759,37,9661),(347759,47,7561),(347759,71,4969),(347759,73,4831)
(347759,109,3221),(347759,139,2521),(347759,181,1933),(347759,211,1657),(347759,271,1289),(347759,421,829),(347759,461,757)]),(
2,[(453599,61,7561),(453599,71,6481),(453599,73,6301),(453599,109,4201),(453599,113,4051),(453599,163,2801),(453599,181,2521),(
53599,211,2161),(453599,281,1621),(453599,379,1201),(453599,433,1051),(453599,601,757)])]"
无心人
发表于 2009-3-10 10:36:17
2,3,4的对
5的最小是1151
6的最小是2399
7的最小是9719
这个确定是最小的了
无心人
发表于 2009-3-10 10:39:24
8的是19319
9的最小是7559(已确定)
10的166319
11的347759
12的453599
8,10-12的无法确定最小