无心人
发表于 2008-5-12 20:10:47
前20正整数的4次幂划分
Prelude List> sum (map (^4) n20)
722666
Prelude List> div 722666 2
361333
Prelude List> let f1 x = (sum (map (^4) x)) == 361333
Prelude List> let l4_20 = filter f1 (selectDistinct 10 n20)
Prelude List> l4_20
[,,[1,4,5,8,10,13,14,16,1
7,19],,,[2,3,6,7,9,11,12,15
,18,20],,]
Prelude List> length l4_20
8
共4组
无心人
发表于 2008-5-12 20:15:35
同样道理证明16的没4次幂划分
Prelude List> sum (map (^4) n16)
243848
Prelude List> div 243848 2
121924
Prelude List> let f1 x = (sum (map (^4) x)) == 121924
Prelude List> let l4_16= filter f1 (selectDistinct 8 n16)
Prelude List> l4_16
[]
Prelude List> n16
无心人
发表于 2008-5-12 20:19:40
考虑5次幂情况
尝试求和得到下列结果
Prelude List> let n22=
Prelude List> let n24=
Prelude List> let n26=
Prelude List> let n28=
Prelude List> let n30=
Prelude List> let n32=
Prelude List> sum (map (^5) n16)
3347776
Prelude List> sum (map (^5) n20)
12333300
Prelude List> sum (map (^5) n22)
21571033
Prelude List> sum (map (^5) n24)
35970000
Prelude List> sum (map (^5) n26)
57617001
Prelude List> sum (map (^5) n28)
89176276
Prelude List> sum (map (^5) n30)
133987425
Prelude List> sum (map (^5) n32)
196171008
Prelude List> sum (map (^5) n18)
6657201
从16到32,可能数字是16, 20, 24, 28, 32
无心人
发表于 2008-5-12 20:24:29
5次幂划分
16, 20没找到结果
无心人
发表于 2008-5-12 20:28:32
24的5次幂划分得到结果!!!!
Prelude List> div 35970000 2
17985000
Prelude List> let f5 x = (sum (map (^5) x)) == 17985000
Prelude List> let l5_24 = filter f5 (selectDistinct 12 n24)
Prelude List> l5_24
[,,[3,4,7,8,9,11
,12,13,17,21,22,23],,[1,2,4,10,11,13,14,15,16,1
8,22,24],]
Prelude List> length l5_24
6
共三组
无心人
发表于 2008-6-20 10:23:29
let position=
let color=['R', 'B', 'Y', 'W', 'G']
let contnationality=['E','G', 'S', 'D', 'N']
let pet=['D', 'C', 'B', 'H', 'F']
let drink=['T', 'C', 'M', 'W', 'B']
let cigarette=['P', 'D', 'B', 'R', 'U']
let t6 = [(x1, x2, x3, x4, x5, x6) | x1 <- position, x2 <- color, x3 <- contnationality, x4 <- pet, x5 <- drink, x6 <- cigarette]
[ 本帖最后由 无心人 于 2008-6-20 15:59 编辑 ]
无心人
发表于 2008-6-20 10:25:54
位置编号:1,2,3,4,5
颜色编号: R, B, Y, W, G
国籍编号:E英国,G德国,S瑞典,D丹麦,N挪威
宠物:D狗,C猫,B鸟,H马,F鱼
饮料:T茶,C咖啡,M牛奶,W矿泉水,B啤酒
香烟:P = PALLMALL
D = DUNHILL
B = BULEMASTER
R=PRINCE
U=混合
[ 本帖最后由 无心人 于 2008-6-20 11:12 编辑 ]
无心人
发表于 2008-6-20 10:38:04
相邻的界定
let isNeighbor x y = abs(x-y) == 1
1、英国人住在红房子里
2、瑞典人养了一条狗
3、丹麦人喝茶
4、绿房子在白房子的左边
5、绿房子主人喝咖啡
6、抽PALL MALL 烟的人养了一只鸟
7、黄房子主人抽DUNHILL烟
8、住在中间房子的人喝牛奶
9、挪威人住在第一间房子
10、抽混合烟的人住在养猫人的旁边
11、养马人住在抽DUNHILL烟人的旁边
12、抽BLUE MASTER烟的人喝啤酒
13、德国人抽PRINCE烟
14、挪威人住在蓝房子旁边
15、抽混合烟的人的邻居喝矿泉水
无心人
发表于 2008-6-20 10:58:39
xor 实现
let xor a b = (a || b)&& (not (a && b))
条件1:
let filter1 (x1, x2, x3, x4, x5, x6) = not (xor (x2 =='R') (x3 == 'E'))
条件2:
let filter2 (x1, x2, x3, x4, x5, x6) = not (xor (x4 =='D') (x3 == 'S'))
条件3:
let filter3 (x1, x2, x3, x4, x5, x6) = not (xor (x5 =='T') (x3 == 'D'))
条件5:
let filter5 (x1, x2, x3, x4, x5, x6) = not (xor (x2 =='G') (x5 == 'C'))
条件6
let filter6 (x1, x2, x3, x4, x5, x6) = not (xor (x6 =='P') (x4 == 'B'))
[ 本帖最后由 无心人 于 2008-6-20 16:02 编辑 ]
无心人
发表于 2008-6-20 11:11:52
条件7:
let filter7 (x1, x2, x3, x4, x5, x6) = not (xor (x2 =='Y') (x6 == 'D'))
条件8:
let filter8 (x1, x2, x3, x4, x5, x6) = not (xor (x1 ==3) (x5 == 'M'))
条件9:
let filter9 (x1, x2, x3, x4, x5, x6) = not (xor (x1 ==1) (x3 == 'N'))
[ 本帖最后由 无心人 于 2008-6-20 11:54 编辑 ]