Added some further ipython solutions.
This commit is contained in:
@@ -10,31 +10,41 @@
|
||||
"\n",
|
||||
"$2^2=4, 2^3=8, 2^4=16, 2^5=32$\n",
|
||||
"\n",
|
||||
"32=9, 33=27, 34=81, 35=243\n",
|
||||
"$3^2=9, 3^3=27, 3^4=81, 3^5=243$\n",
|
||||
"\n",
|
||||
"42=16, 43=64, 44=256, 45=1024\n",
|
||||
"$4^2=16, 4^3=64, 4^4=256, 4^5=1024$\n",
|
||||
"\n",
|
||||
"52=25, 53=125, 54=625, 55=3125\n",
|
||||
"$5^2=25, 5^3=125, 5^4=625, 5^5=3125$\n",
|
||||
"\n",
|
||||
"If they are then placed in numerical order, with any repeats removed, we get the following sequence of 15 distinct terms:\n",
|
||||
"\n",
|
||||
"4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125\n",
|
||||
"$4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125$\n",
|
||||
"\n",
|
||||
"How many distinct terms are in the sequence generated by ab for 2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?"
|
||||
"How many distinct terms are in the sequence generated by $a^b$ for $2 ≤ a ≤ 100$ and $2 ≤ b ≤ 100$?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"9183\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"s = len(set([a**b for a in range(2, 101) for b in range(2, 101)]))\n",
|
||||
"assert(s == 9183)\n",
|
||||
"print(s)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"comopletion_date": "",
|
||||
"comopletion_date": "Fri, 25 Aug 2017, 10:03",
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
@@ -52,7 +62,10 @@
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.6.3"
|
||||
},
|
||||
"tags": []
|
||||
"tags": [
|
||||
"distinct",
|
||||
"powers"
|
||||
]
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
|
||||
Reference in New Issue
Block a user