Skip to content

Commit 6d4dc3a

Browse files
authored
Divisible by all numbers from 1 to 20
1 parent 30d27e1 commit 6d4dc3a

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

Euler_Problem5_Divisible by 20.ipynb

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"mylist=[]\n",
10+
"for i in range(1,21):\n",
11+
" mylist.append(i)"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": 2,
17+
"metadata": {},
18+
"outputs": [
19+
{
20+
"name": "stdout",
21+
"output_type": "stream",
22+
"text": [
23+
"232792560\n"
24+
]
25+
}
26+
],
27+
"source": [
28+
"num=20\n",
29+
"while True:\n",
30+
" for i in mylist:\n",
31+
" if num%i!=0:\n",
32+
" num+=20\n",
33+
" break\n",
34+
" else: \n",
35+
" print(num)\n",
36+
" break\n",
37+
"\n",
38+
" \n",
39+
" "
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"metadata": {},
46+
"outputs": [],
47+
"source": []
48+
}
49+
],
50+
"metadata": {
51+
"kernelspec": {
52+
"display_name": "Python 3",
53+
"language": "python",
54+
"name": "python3"
55+
},
56+
"language_info": {
57+
"codemirror_mode": {
58+
"name": "ipython",
59+
"version": 3
60+
},
61+
"file_extension": ".py",
62+
"mimetype": "text/x-python",
63+
"name": "python",
64+
"nbconvert_exporter": "python",
65+
"pygments_lexer": "ipython3",
66+
"version": "3.8.5"
67+
}
68+
},
69+
"nbformat": 4,
70+
"nbformat_minor": 4
71+
}

0 commit comments

Comments
 (0)