dbd7237ece35

SSET
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 20 Dec 2019 17:12:29 -0500
parents dbd94aef5f92
children 72cd66a36853
branches/tags (none)
files src/problems/sset.lisp

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/problems/sset.lisp	Fri Dec 20 17:12:29 2019 -0500
@@ -0,0 +1,16 @@
+(in-package :rosalind)
+
+;; The cardinality of a power set is 2ⁿ, because you can represent an individual
+;; set as a binary string where 1 means the element is included and 0 is not,
+;; and there are 2ⁿ possible binary strings of length n.
+
+(define-problem sset (data stream)
+    "3"
+    "8"
+  (mod (expt 2 (read data)) 1000000))
+
+
+#; Scratch --------------------------------------------------------------------
+
+(problem-sset)
+(solve sset)