Automatic commit performed through alias...
This commit is contained in:
98
problems/016_problem/016_problem.ipynb
Normal file
98
problems/016_problem/016_problem.ipynb
Normal file
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Problem 16:\n",
|
||||
" \n",
|
||||
"### [Euler Project #16](https://projecteuler.net/problem=16)\n",
|
||||
" \n",
|
||||
"### 215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.\n",
|
||||
"\n",
|
||||
"### What is the sum of the digits of the number 21000?\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"---"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### This seems pretty straightforward..."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"big_integer=2**1000\n",
|
||||
"print(big_integer)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<class 'str'>\n",
|
||||
"['1', '0', '7', '1', '5', '0', '8', '6', '0', '7', '1', '8', '6', '2', '6', '7', '3', '2', '0', '9', '4', '8', '4', '2', '5', '0', '4', '9', '0', '6', '0', '0', '0', '1', '8', '1', '0', '5', '6', '1', '4', '0', '4', '8', '1', '1', '7', '0', '5', '5', '3', '3', '6', '0', '7', '4', '4', '3', '7', '5', '0', '3', '8', '8', '3', '7', '0', '3', '5', '1', '0', '5', '1', '1', '2', '4', '9', '3', '6', '1', '2', '2', '4', '9', '3', '1', '9', '8', '3', '7', '8', '8', '1', '5', '6', '9', '5', '8', '5', '8', '1', '2', '7', '5', '9', '4', '6', '7', '2', '9', '1', '7', '5', '5', '3', '1', '4', '6', '8', '2', '5', '1', '8', '7', '1', '4', '5', '2', '8', '5', '6', '9', '2', '3', '1', '4', '0', '4', '3', '5', '9', '8', '4', '5', '7', '7', '5', '7', '4', '6', '9', '8', '5', '7', '4', '8', '0', '3', '9', '3', '4', '5', '6', '7', '7', '7', '4', '8', '2', '4', '2', '3', '0', '9', '8', '5', '4', '2', '1', '0', '7', '4', '6', '0', '5', '0', '6', '2', '3', '7', '1', '1', '4', '1', '8', '7', '7', '9', '5', '4', '1', '8', '2', '1', '5', '3', '0', '4', '6', '4', '7', '4', '9', '8', '3', '5', '8', '1', '9', '4', '1', '2', '6', '7', '3', '9', '8', '7', '6', '7', '5', '5', '9', '1', '6', '5', '5', '4', '3', '9', '4', '6', '0', '7', '7', '0', '6', '2', '9', '1', '4', '5', '7', '1', '1', '9', '6', '4', '7', '7', '6', '8', '6', '5', '4', '2', '1', '6', '7', '6', '6', '0', '4', '2', '9', '8', '3', '1', '6', '5', '2', '6', '2', '4', '3', '8', '6', '8', '3', '7', '2', '0', '5', '6', '6', '8', '0', '6', '9', '3', '7', '6']\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"sum=0\n",
|
||||
"sum+=big_integer%10\n",
|
||||
"\n",
|
||||
"str_big_integer=str(big_integer)\n",
|
||||
"print(type(str_big_integer))\n",
|
||||
"\n",
|
||||
"list_big_integer=list(str_big_integer)\n",
|
||||
"print(list_big_integer)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
Reference in New Issue
Block a user