|
12 | 12 | }, |
13 | 13 | { |
14 | 14 | "cell_type": "code", |
15 | | - "execution_count": 1, |
| 15 | + "execution_count": 4, |
16 | 16 | "id": "6040bded7e982e0c", |
17 | 17 | "metadata": { |
18 | 18 | "ExecuteTime": { |
|
29 | 29 | "import mathf" |
30 | 30 | ] |
31 | 31 | }, |
| 32 | + { |
| 33 | + "cell_type": "raw", |
| 34 | + "metadata": { |
| 35 | + "vscode": { |
| 36 | + "languageId": "raw" |
| 37 | + } |
| 38 | + }, |
| 39 | + "source": [ |
| 40 | + "## Understanding the Mathematical Problem\n", |
| 41 | + "\n", |
| 42 | + "### Fibonacci Numbers\n", |
| 43 | + "The Fibonacci sequence is one of the most famous sequences in mathematics, where each number is the sum of the two preceding ones:\n", |
| 44 | + "**1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...**\n", |
| 45 | + "\n", |
| 46 | + "### The Research Question\n", |
| 47 | + "We're investigating an interesting mathematical relationship: **Which Fibonacci numbers are multiples of prime numbers?**\n", |
| 48 | + "\n", |
| 49 | + "Specifically, we want to explore:\n", |
| 50 | + "- Given a prime number (like 17), which Fibonacci numbers are divisible by it?\n", |
| 51 | + "- How large do these numbers get?\n", |
| 52 | + "- Is there a pattern in their occurrence?\n", |
| 53 | + "\n", |
| 54 | + "### Why This Matters\n", |
| 55 | + "This type of research helps us understand:\n", |
| 56 | + "- **Number theory patterns**: How different mathematical sequences interact\n", |
| 57 | + "- **Divisibility properties**: When and why certain relationships occur\n", |
| 58 | + "- **Computational mathematics**: How to efficiently find these relationships\n", |
| 59 | + "\n", |
| 60 | + "### What We'll Discover\n", |
| 61 | + "In the analysis below, we'll find the first 10 Fibonacci numbers that are multiples of 17, revealing how quickly these numbers grow and providing insight into the fascinating intersection of prime numbers and the Fibonacci sequence.\n" |
| 62 | + ] |
| 63 | + }, |
32 | 64 | { |
33 | 65 | "cell_type": "markdown", |
34 | 66 | "id": "9209940ceb5e46c0", |
|
41 | 73 | }, |
42 | 74 | { |
43 | 75 | "cell_type": "code", |
44 | | - "execution_count": 2, |
| 76 | + "execution_count": null, |
45 | 77 | "id": "c8beeefbe98fd1b8", |
46 | 78 | "metadata": { |
47 | 79 | "ExecuteTime": { |
|
51 | 83 | }, |
52 | 84 | "outputs": [], |
53 | 85 | "source": [ |
| 86 | + "from itertools import islice\n", |
| 87 | + "\n", |
54 | 88 | "prime = 17\n", |
55 | 89 | "all_fibs = mathf.fibonacci()\n", |
56 | | - "based_fibs = mathf.multiples_of(all_fibs, prime)\n", |
| 90 | + "fib_multiples_of_prime = mathf.multiples_of(all_fibs, prime)\n", |
57 | 91 | "\n", |
58 | | - "first_10 = []\n", |
59 | | - "for idx, fib in enumerate(based_fibs):\n", |
60 | | - " first_10.append(fib)\n", |
61 | | - " if idx > 10:\n", |
62 | | - " break" |
| 92 | + "first_10 = list(islice(fib_multiples_of_prime, 10))" |
63 | 93 | ] |
64 | 94 | }, |
65 | 95 | { |
|
72 | 102 | }, |
73 | 103 | { |
74 | 104 | "cell_type": "code", |
75 | | - "execution_count": 3, |
| 105 | + "execution_count": 8, |
76 | 106 | "id": "980daf7b8a4f2a61", |
77 | 107 | "metadata": { |
78 | 108 | "ExecuteTime": { |
|
99 | 129 | "37,889,062,373,143,906\n", |
100 | 130 | "2,880,067,194,370,816,120\n", |
101 | 131 | "218,922,995,834,555,169,026\n", |
102 | | - "16,641,027,750,620,563,662,096\n" |
| 132 | + "16,641,027,750,620,563,662,096\n", |
| 133 | + "1,264,937,032,042,997,393,488,322\n", |
| 134 | + "96,151,855,463,018,422,468,774,568\n", |
| 135 | + "7,308,805,952,221,443,105,020,355,490\n", |
| 136 | + "555,565,404,224,292,694,404,015,791,808\n", |
| 137 | + "42,230,279,526,998,466,217,810,220,532,898\n" |
103 | 138 | ] |
104 | 139 | } |
105 | 140 | ], |
|
120 | 155 | ], |
121 | 156 | "metadata": { |
122 | 157 | "kernelspec": { |
123 | | - "display_name": "Python 3 (ipykernel)", |
| 158 | + "display_name": "venv", |
124 | 159 | "language": "python", |
125 | 160 | "name": "python3" |
126 | 161 | }, |
|
0 commit comments