Palindromic gapful numbers: Difference between revisions
Content deleted Content added
SqrtNegInf (talk | contribs) Added Perl |
m →Ludicrously fast to 1,000,000,000,000,000th: *10,000 on 64 bit |
||
Line 2,738: | Line 2,738: | ||
</pre> |
</pre> |
||
=== Ludicrously fast to |
=== Ludicrously fast to 10,000,000,000,000,000,000th === |
||
Astonishingly this is all done with standard precision numbers, < 2<sup><small>53</small></sup>. You realise this is like ten times the ''square'' of the previous limits, and still far faster.<br> |
Astonishingly this is all done with standard precision numbers, < 2<sup><small>53</small></sup>. You realise this is like ten thousand times the ''square'' of the previous limits, and still far faster.<br> |
||
I will credit [[Self_numbers#AppleScript]] and the comment by Nigel Galloway on the talk page for ideas that inspired me. |
I will credit [[Self_numbers#AppleScript]] and the comment by Nigel Galloway on the talk page for ideas that inspired me. |
||
<lang Phix>-- demo/rosetta/Palindromic_gapful_numbers.exw |
<lang Phix>-- demo/rosetta/Palindromic_gapful_numbers.exw |
||
Line 2,918: | Line 2,918: | ||
{100_000_000_000,1,9},{1000_000_000_000,1,9}, |
{100_000_000_000,1,9},{1000_000_000_000,1,9}, |
||
{10_000_000_000_000,1,9},{100_000_000_000_000,1,9}, |
{10_000_000_000_000,1,9},{100_000_000_000_000,1,9}, |
||
{1000_000_000_000_000,1,9} |
{1000_000_000_000_000,1,9}, |
||
{10_000_000_000_000_000_000,1,9}} -- 64 bit only |
|||
-- (any further and you'd need mpfr just to hold counts) |
-- (any further and you'd need mpfr just to hold counts) |
||
atom t0 = time(), count, keep, start |
atom t0 = time(), count, keep, start |
||
for i=1 to length(tests) do |
for i=1 to length(tests)-(machine_bits()!=64) do |
||
{count, keep, start} = tests[i] |
{count, keep, start} = tests[i] |
||
atom from = count-keep+1 |
atom from = count-keep+1 |
||
Line 3,043: | Line 3,044: | ||
Completed in 0.7s |
Completed in 0.7s |
||
</pre> |
|||
On 64bit you'll also get |
|||
<pre> |
|||
10,000,000,000,000,000,000th palindromic gapful number ending with: |
|||
9: 968787878787878787639936787878787878787869 |
|||
</pre> |
</pre> |
||
I would agree that the last entry does not feel very convincing. Depending on how much |
I would agree that the last entry does not feel very convincing. Depending on how much |