

Pumping the Primes - breadbox
http://bit-player.org/2015/pumping-the-primes

======
dmichulke
For the clojure people:

    
    
      (let [gcd (fn [x y]
    	      (if (pos? y)
    		  (recur y (mod x y))
    		x))]
      (->> [2 7 1]
        (iterate (fn [[n a]]
    		 (let [g (gcd n a)]
    		   [(inc n) (+ a g) g])))
        (filter (comp #(< 1 %) last))
        (take 20)))
    

I would format it better if I knew how to.

Anyway, the last element of each vector (that is, the g) in the resulting
sequence is always a prime.

~~~
dmichulke
Regarding run time, you can see there is no free lunch:

The first twenty elements are returned in 4msecs. The first 200 are still
running (> 2 hours already).

------
msie
I looked up Matt Frank (mentioned in the article) and I see that he's now
working in Finance. Surprise, surprise! :D

