src/rosalind/p006.clj @ 7f4e6345e260
Do the first few problems.
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Mon, 12 Nov 2012 12:36:49 -0500 |
parents | (none) |
children | (none) |
(ns rosalind.p006 (:require [clojure.math.combinatorics :refer [permutations]] [clojure.string :refer [join trim]])) (def sample "3") (defn solve [s] (let [ps (permutations (range 1 (inc (Long/parseLong (trim s)))))] (println (count ps)) (dorun (map #(println (join " " %)) ps)))) (solve sample) (solve (slurp "/Users/sjl/Downloads/rosalind_perm.txt"))