Jump to content

Palindromic gapful numbers: Difference between revisions

m
(Added Perl)
Line 2,738:
</pre>
 
=== Ludicrously fast to 110,000,000,000,000,000,000th ===
Astonishingly this is all done with standard precision numbers, &lt; 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.
<lang Phix>-- demo/rosetta/Palindromic_gapful_numbers.exw
Line 2,918:
{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},
{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)
 
atom t0 = time(), count, keep, start
for i=1 to length(tests)-(machine_bits()!=64) do
{count, keep, start} = tests[i]
atom from = count-keep+1
Line 3,043 ⟶ 3,044:
 
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>
I would agree that the last entry does not feel very convincing. Depending on how much
7,830

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.