aboutsummaryrefslogtreecommitdiff
path: root/helper/numbers.py
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-08-12 15:47:31 +0200
committerCharles <sircharlesaze@gmail.com>2019-08-12 15:47:31 +0200
commitbb515e51d67f37ba9c6dfbd2fd0930be873a5ada (patch)
treee86abea100d2c02a5dad7b6d5f0bf29c307bae04 /helper/numbers.py
parent1879caa1dd80cb11dd62403663917ad4bf7cc68e (diff)
downloadproject_euler-bb515e51d67f37ba9c6dfbd2fd0930be873a5ada.tar.gz
project_euler-bb515e51d67f37ba9c6dfbd2fd0930be873a5ada.tar.bz2
project_euler-bb515e51d67f37ba9c6dfbd2fd0930be873a5ada.zip
haskell problems 007 -> 010
Diffstat (limited to 'helper/numbers.py')
-rw-r--r--helper/numbers.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/helper/numbers.py b/helper/numbers.py
deleted file mode 100644
index f99f205..0000000
--- a/helper/numbers.py
+++ /dev/null
@@ -1,47 +0,0 @@
-from functools import reduce
-from itertools import count
-
-
-def sum_digits(n):
- return reduce(lambda x, y: x + int(y), str(n), 0)
-
-
-def triangular(n):
- return n * (n+1) // 2
-
-
-def pentagonal(n):
- return n * (3*n - 1) // 2
-
-
-def hexagonal(n):
- return n * (2*n - 1)
-
-
-def is_triangular(n):
- for i in count(1):
- t = triangular(i)
- if t >= n:
- return t == n
-
-
-# def is_pentagonal(n):
-# for i in count(1):
-# p = pentagonal(i)
-# if p >= n:
-# return p == n
-
-
-# def is_hexagonal(n):
-# for i in count(1):
-# h = hexagonal(i)
-# if h >= n:
-# return h == n
-
-
-def proper_divisors(num):
- divisor = []
- for i in range(1, num):
- if num % i == 0:
- divisor.append(i)
- return divisor