This commit is contained in:
ikselven 2017-07-11 21:52:32 +02:00
commit c19129e6dd
4 changed files with 26 additions and 0 deletions

1
16/euler16.py Normal file
View file

@ -0,0 +1 @@
sum([int(x) for x in list(str(2**1000))])

2
20/euler20.py Normal file
View file

@ -0,0 +1,2 @@
import math
sum([int(x) for x in list(str(math.factorial(100)))])

22
47/euler47.rkt Normal file
View file

@ -0,0 +1,22 @@
#lang racket
(require math/number-theory)
(define (primefactors x)
(if (prime? x)
(list x)
(for/or ((i (cons 2 (range 3 (+ 1 (ceiling (sqrt x))) 2)))
#:when (prime? i)
#:when (zero? (remainder x i)))
(cons i (primefactors (quotient x i))))))
(define (recur x)
(if (and
(equal? (length (remove-duplicates (primefactors x))) 4)
(equal? (length (remove-duplicates (primefactors (+ x 1)))) 4)
(equal? (length (remove-duplicates (primefactors (+ x 2)))) 4)
(equal? (length (remove-duplicates (primefactors (+ x 3)))) 4))
x
(recur (+ x 1))))
(recur 2)

1
48/euler48.py Normal file
View file

@ -0,0 +1 @@
str(sum([x**x for x in range(1,1001)]))[-10:]