One of the properties of the number associated with my diurnal age today (\( \textbf{27792} \)) is that it can be expressed as a sum of two squares as well as a sum of two cubes:$$ \begin{align} 27792 &= 84^2+144^2 \\ &= 23^3+25^3 \end{align} $$This immediately caused me to wonder how frequent numbers of this sort are. I asked Gemini to write me a Python program that would output a list of non-negative, non-zero numbers in the range up to 40000 with this dual property. I'm getting lazy I know. Previously, I would have created the SageMath code myself but ... well, this is the future I guess. Here is a link to the code.
As it turns out, such numbers are not that frequent. Here is the list:
65, 370, 468, 520, 637, 730, 793, 1125, 1241, 1332, 1853, 2205, 2745, 2960, 3744, 3925, 4097, 4160, 4706, 4825, 4941, 5096, 5256, 5840, 5913, 6344, 6641, 6984, 7202, 8125, 9000, 9325, 9386, 9477, 9773, 9928, 10656, 11458, 12005, 12168, 12913, 13357, 13498, 13949, 14824, 15626, 15633, 15689, 16021, 16354, 17261, 17640, 18369, 18737, 19721, 19773, 21953, 21960, 22681, 23680, 24901, 26117, 27792, 29449, 29818, 29952, 31213, 31400, 31850, 32389, 32776, 33280, 33650, 34704, 35037, 36650, 37577, 37648, 37681, 38600, 39429, 39528
I was surprised not to find this sequence in the OEIS. I asked Gemini to also give a breakdown of the numbers in terms of their squares and cubes. Figure 1 shows the result.
![]() |
Figure 1 |
My apologies for the persistent error. It seems SageMathCell might be interpreting the f-string syntax slightly differently or having an issue with the way the curly braces are nested, particularly around the conditional expression. Let's try a slightly different approach to formatting the output string, using the .format() method instead of f-strings. This might be more compatible with SageMathCell.
![]() |
Figure 2 |
![]() |
Figure 3 |
No comments:
Post a Comment