"cells": [
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 1,
"metadata": {
"collapsed": false,
"scrolled": true
"104743"
]
},
- "execution_count": 12,
+ "execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 2,
"metadata": {
"collapsed": false
},
"[2, 3, 5]"
]
},
- "execution_count": 13,
+ "execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 3,
"metadata": {
"collapsed": false
},
":prime_slice"
]
},
- "execution_count": 17,
+ "execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 4,
"metadata": {
"collapsed": false
},
":sum_primes"
]
},
- "execution_count": 18,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 5,
"metadata": {
"collapsed": false
},
"[2, 3, 5, 7, 11]"
]
},
- "execution_count": 20,
+ "execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 6,
"metadata": {
"collapsed": false
},
"28"
]
},
- "execution_count": 19,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 30,
+ "execution_count": 8,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "0 - 2 : 5\n",
- "0 - 4 : 17\n",
- "0 - 6 : 41\n",
- "0 - 12 : 197\n",
- "0 - 14 : 281\n",
- "0 - 60 : 7699\n",
- "0 - 64 : 8893\n",
- "0 - 96 : 22039\n",
- "0 - 100 : 24133\n",
- "0 - 102 : 25237\n",
- "0 - 108 : 28697\n",
- "0 - 114 : 32353\n",
- "0 - 122 : 37561\n",
- "0 - 124 : 38921\n",
- "0 - 130 : 43201\n",
- "0 - 132 : 44683\n",
- "0 - 146 : 55837\n",
- "0 - 152 : 61027\n",
- "0 - 158 : 66463\n",
- "0 - 162 : 70241\n",
- "0 - 178 : 86453\n",
- "0 - 192 : 102001\n",
- "0 - 198 : 109147\n",
- "0 - 204 : 116533\n",
- "0 - 206 : 119069\n",
- "0 - 208 : 121631\n",
- "0 - 214 : 129419\n",
- "0 - 216 : 132059\n",
- "0 - 296 : 263171\n",
- "0 - 308 : 287137\n",
- "0 - 326 : 325019\n",
- "0 - 328 : 329401\n",
- "0 - 330 : 333821\n",
- "0 - 332 : 338279\n",
- "0 - 334 : 342761\n",
- "0 - 342 : 360979\n",
- "0 - 350 : 379667\n",
- "0 - 356 : 393961\n",
- "0 - 358 : 398771\n",
- "0 - 426 : 581921\n",
- "0 - 446 : 642869\n",
- "0 - 458 : 681257\n",
- "0 - 460 : 687767\n",
- "0 - 464 : 700897\n",
- "0 - 480 : 754573\n",
- "0 - 484 : 768373\n",
- "0 - 488 : 782263\n",
- "0 - 512 : 868151\n",
- "0 - 530 : 935507\n",
- "0 - 536 : 958577\n",
- "2 - 537 : 970219\n",
- "2 - 539 : 978037\n",
- "3 - 543 : 997651\n"
- ]
- },
{
"data": {
"text/plain": [
"[3, 543, 997651]"
]
},
- "execution_count": 30,
+ "execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
"start = 0\n",
"best_start = 0\n",
"best_length = 1\n",
- "while primes[start] <= sum_limit\n",
+ "while $primes[start] <= sum_limit\n",
" # puts start\n",
" length = 1\n",
" sp = sum_primes(start, length)\n",