aboutsummaryrefslogtreecommitdiff
path: root/python/36-double_base_palindrome.py
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-08-11 18:42:52 +0200
committerCharles <sircharlesaze@gmail.com>2019-08-11 18:42:52 +0200
commit7b624de8e3e3637a07364f992c1d7e4185e4a872 (patch)
treefdb9b0c3f9185b267f9f7bfb9cb4b0e4cdd8cc16 /python/36-double_base_palindrome.py
downloadproject_euler-7b624de8e3e3637a07364f992c1d7e4185e4a872.tar.gz
project_euler-7b624de8e3e3637a07364f992c1d7e4185e4a872.tar.bz2
project_euler-7b624de8e3e3637a07364f992c1d7e4185e4a872.zip
initial commit
Diffstat (limited to 'python/36-double_base_palindrome.py')
-rw-r--r--python/36-double_base_palindrome.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/python/36-double_base_palindrome.py b/python/36-double_base_palindrome.py
new file mode 100644
index 0000000..758ad1b
--- /dev/null
+++ b/python/36-double_base_palindrome.py
@@ -0,0 +1,8 @@
+# https://projecteuler.net/problem=36
+
+sum = 0
+for nb in range(1_000_000):
+ if str(nb) == str(nb)[::-1] and f'{nb:b}' == f'{nb:b}'[::-1]:
+ sum += nb
+
+print(sum)