login
A322289
Primes sorted by quadratic irrational continued fraction terms.
1
5, 3, 2, 17, 13, 7, 37, 41, 29, 11, 73, 61, 53, 19, 23, 109, 89, 101, 97, 113, 31, 149, 157, 137, 43, 47, 193, 197, 181, 173, 59, 277, 241, 281, 269, 257, 233, 229, 67, 71, 79, 313, 337, 349, 353, 317, 293, 83, 409, 421, 433, 389, 401, 373, 397, 103, 107
OFFSET
1,1
COMMENTS
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.
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)).
LINKS
Pierre Abbat, Quadlods
EXAMPLE
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.
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.
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.
PROG
(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.
CROSSREFS
Permutation of A000040. Cf. A001622 (phi).
Sequence in context: A268690 A065627 A193958 * A259228 A241182 A193799
KEYWORD
nonn
AUTHOR
Pierre Abbat, Sep 09 2019
STATUS
approved