Verified 53 til 57.

This commit is contained in:
2018-12-24 18:41:37 -05:00
parent 147a13a01f
commit 0ee19fa69f
9 changed files with 132 additions and 63 deletions

View File

@@ -36,23 +36,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"def get_digit_count(n):\n",
" c = 1\n",
" c = 0\n",
" while n:\n",
" n += 1\n",
" c += 1\n",
" n //= 10\n",
" return d"
" return c\n",
"\n",
"assert(get_digit_count(1337) == 4)"
]
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": 2,
"metadata": {
"collapsed": true
},
@@ -78,10 +78,8 @@
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"collapsed": true
},
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def next_expension(n, d):\n",
@@ -92,14 +90,14 @@
"\n",
"n, d = (3, 2)\n",
"for i in range(1000):\n",
" if get_digit_count(n)> get_digit_count(d):\n",
" if get_digit_count(n) > get_digit_count(d):\n",
" c += 1\n",
" n, d = next_expension(n, d)"
]
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 4,
"metadata": {},
"outputs": [
{
@@ -112,7 +110,8 @@
],
"source": [
"s = c\n",
"print(s)"
"print(s)\n",
"assert(s == 153)"
]
},
{
@@ -126,7 +125,7 @@
}
],
"metadata": {
"completion_date": "",
"completion_date": "Mon, 24 Dec 2018, 23:35",
"kernelspec": {
"display_name": "Python 3",
"language": "python3.6",
@@ -144,7 +143,12 @@
"pygments_lexer": "ipython3",
"version": "3.6.5"
},
"tags": []
"tags": [
"square root",
"gcd",
"airplane",
"fractions"
]
},
"nbformat": 4,
"nbformat_minor": 2