display the numbers of interest

This commit is contained in:
filifa 2025-07-20 14:56:56 -04:00
parent 34775e69a3
commit 6b0378bcd5
1 changed files with 40 additions and 1 deletions

View File

@ -19,7 +19,25 @@
{
"data": {
"text/plain": [
"872187"
"{1,\n",
" 3,\n",
" 5,\n",
" 7,\n",
" 9,\n",
" 33,\n",
" 99,\n",
" 313,\n",
" 585,\n",
" 717,\n",
" 7447,\n",
" 9009,\n",
" 15351,\n",
" 32223,\n",
" 39993,\n",
" 53235,\n",
" 53835,\n",
" 73737,\n",
" 585585}"
]
},
"execution_count": 1,
@ -32,6 +50,27 @@
"is_base_10_palindrome = lambda x: str(x) == str(x)[::-1]\n",
"\n",
"double_palindromes = {n for n in range(1, 1000000) if is_base_2_palindrome(n) and is_base_10_palindrome(n)}\n",
"double_palindromes"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "ce61e551",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"872187"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sum(double_palindromes)"
]
},