Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Even if you succeed in taming the strange quadratic F# sequences design issues, there is certain algorithmic improvements still ahead. You are working in <code>(...((x-a)-b)-...)</code> manner here. <code>x</code>, or <code>around6</code>, is getting deeper and deeper, but it's the most frequently-producing sequence. <a href="http://www.haskell.org/haskellwiki/Prime_numbers#Linear_merging" rel="nofollow">Transform</a> it into <code>(x-(a+b+...))</code> scheme - or even use a tree structure to gain improvement in <em>complexity</em>. (sorry, that page is in Haskell). This gets actually very close to the complexity of imperative sieve, although still mush slower than the baseline C++ code. </p> <p>Measuring local <a href="http://en.wikipedia.org/wiki/Analysis_of_algorithms#Empirical_orders_of_growth" rel="nofollow">empirical orders of growth</a> as <code>O(n^a) &lt;--&gt; a = log(t_2/t_1) / log(n_2/n_1)</code> (<em>in <code>n</code> primes produced</em>), the ideal <code>n log(n) log(log(n))</code> translates into <code>O(n^1.12) .. O(n^1.085)</code> behaviour on <code>n=10^5..10^7</code> range. A simple C++ baseline <a href="http://ideone.com/fapob" rel="nofollow">imperative code</a> achieves <code>O(n^1.45 .. 1.18 .. 1.14)</code> while <a href="http://ideone.com/p0e81" rel="nofollow">tree-merging code</a>, as well as priority-queue based code, both exhibit steady <code>O(n^1.20)</code> behaviour, more or less. Of course C++ is ~<s>50</s><strong>20..15</strong> times faster, but that's mostly just a "constant factor". :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload