One of these days, I ought to go back through the lessons and see what's been said about ⌸ because it's great for golf but I have no idea how to use it
@ngn I think I understand most of it. I just fail to see how it could go past 5 iterations. My understanding is, since i←1+⍣{?2}¯1 can only be one of 0 1 2 3, ⍳2⍴2+i←1+⍣{?2}¯1 would generate at most ⍳2⍴5 iterations, no?
I mean, I can see from the tests that it does go past the 5th iteration, but I don't see how.
And by iterations I mean fractions
Testing shows me that i can be > 3; I think that means I don't understand ⍣ that well.
as FrownyFrog said, {?2} is randomly either 0 or 1. ⍣ could make potentially infinite iterations.
⍳2⍴5 will make a gcd table of i+2 by i+2. the indices of each 1 value in that table correspond the numerator and denominator of a rational number.
every row of that table, except the first, contains at least one 1, so we know i+2 by i+2 will surely contain the i-th rational
hah, i've just seen an opportunity for -1 byte: ⌽i⊃⍸1=∘.(>×∨)⍨⍳2+i←1+⍣{?2}¯1
@ngn i'm not sure i explained this well, let me try again: 1+⍣{?2}¯1 ←→ 1+ 1+ ... 1+ ¯1. after each "1+" step there's a 50% chance of stopping the sequence.