This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A322289 #36 Sep 13 2019 03:58:58 %S A322289 5,3,2,17,13,7,37,41,29,11,73,61,53,19,23,109,89,101,97,113,31,149, %T A322289 157,137,43,47,193,197,181,173,59,277,241,281,269,257,233,229,67,71, %U A322289 79,313,337,349,353,317,293,83,409,421,433,389,401,373,397,103,107 %N A322289 Primes sorted by quadratic irrational continued fraction terms. %C A322289 For each prime p, if p is congruent to 1 mod 4, compute (1+sqrt(p))/2, otherwise compute sqrt(p). Express it as a periodic continued fraction. Sort them by the largest term in the periodic part; within those that have the same largest term, sort them by the geometric mean of terms. %C A322289 These quadratic irrationals are used in a Richtmyer low-discrepancy sequence generator. Sorting them this way puts the golden ratio first in the list of quadratic irrationals, because (frac(n*phi)) has the lowest discrepancy among sequences of the form (frac(n*a)). %H A322289 Pierre Abbat, <a href="/A322289/b322289.txt">Table of n, a(n) for n = 1..4228</a> %H A322289 Pierre Abbat, <a href="https://github.com/phma/quadlods">Quadlods</a> %e A322289 17 == 1 (mod 4), so compute (sqrt(17)+1)/2 = 2.561552812808830.... Its continued fraction expansion is [2;(1,1,3)]. The largest term is 3. %e A322289 13 == 1 (mod 4), so compute (sqrt(13)+1)/2 = 2.30277563773199.... Its continued fraction expansion is [2;(3)]. The largest term is again 3, but the average term is larger than the average term in (sqrt(17)+1)/2, so 13 goes after 17. %e A322289 7 == 3 (mod 4), so compute sqrt(7) = 2.645751311064590.... Its continued fraction expansion is [2;(1,1,1,4)]. The largest term is 4, so 7 goes after 13. %o A322289 (C++) See Quadlods link. The program generates 6542 terms of the sequence, but after the 4228th term, there are terms larger than 65536, which it does not generate, interspersed. %Y A322289 Permutation of A000040. Cf. A001622 (phi). %K A322289 nonn %O A322289 1,1 %A A322289 _Pierre Abbat_, Sep 09 2019