This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'clojure.set) | |
(defn perms [n s] | |
(if (zero? n) '(()) | |
(reduce (fn [x y] (let [m (dec n) ss (clojure.set/difference s #{y})] | |
(concat x (map (fn [z] (cons y z)) (perms m ss))))) | |
() s))) | |
(defn solv [a] | |
(def b (vec a)) | |
(def appeared (set a)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ps=[] | |
def pre(): | |
f=[True]*1000 | |
for i in xrange(2,1000): | |
if f[i]: | |
ps.append(i) | |
j=i | |
while j<1000: |
NewerOlder