HomeAboutCodePastes
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordieggsy <dieggsy@pm.me>2021-04-12 19:53:55 -0400
committerdieggsy <dieggsy@pm.me>2021-04-12 19:53:55 -0400
commit9e604028882441afdf2c7b158d75e87a899e28b6 (patch)
tree96da1e7c373e9827685faf54fd2c07cf4b82bf30
parent2e4f37a1e92799248f44be0656284041aaab3c6e (diff)
downloadproject-euler-9e604028882441afdf2c7b158d75e87a899e28b6.tar.gz
CHICKEN: Add a slow p62, add TODOs
-rwxr-xr-xchicken/p62.scm26
-rwxr-xr-xchicken/p69.scm2
2 files changed, 27 insertions, 1 deletions
diff --git a/chicken/p62.scm b/chicken/p62.scm
new file mode 100755
index 0000000..665fbba
--- /dev/null
+++ b/chicken/p62.scm
@@ -0,0 +1,26 @@
+#!/usr/bin/chicken-scheme
+
+(import (srfi 1)
+ (srfi 14)
+ (chicken sort))
+
+;; TODO: This is dumb slow, might be faster to iterate starting at 406 and
+;; geenerate permutations of the cube
+(define (p62)
+ (define cubes (map (cut expt <> 3) (iota 10000 1)))
+ (define strings (map (o string->list number->string) cubes))
+ (define equal-groups
+ (map
+ (lambda (s1)
+ (filter
+ (lambda (s2)
+ (and (= (length s1) (length s2))
+ (equal? (sort s1 char<?)
+ (sort s2 char<?))))
+ strings))
+ strings))
+ (find (lambda (l) (= (length l) 5)) equal-groups)
+
+ )
+
+(time (print (p62)))
diff --git a/chicken/p69.scm b/chicken/p69.scm
index 5c26ae8..e5d5e94 100755
--- a/chicken/p69.scm
+++ b/chicken/p69.scm
@@ -1,7 +1,7 @@
#!/usr/bin/chicken-scheme
;; AUTOCOMPILE: -O3
-;; This is pretty slow...
+;; TODO: This is pretty slow...
(import (math number-theory)
(chicken fixnum)
(chicken flonum)