cp's OEIS Frontend

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.

Showing 1-3 of 3 results.

A020652 Numerators in canonical bijection from positive integers to positive rationals.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 2, 3, 4, 1, 5, 1, 2, 3, 4, 5, 6, 1, 3, 5, 7, 1, 2, 4, 5, 7, 8, 1, 3, 7, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 5, 7, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 3, 5, 9, 11, 13, 1, 2, 4, 7, 8, 11, 13, 14, 1, 3, 5, 7, 9, 11, 13, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 5
Offset: 1

Views

Author

Keywords

Comments

a(A002088(n)) = 1 for n > 1. - Reinhard Zumkeller, Jul 29 2012
When read as an irregular table with each 1 entry starting a new row, then the n-th row consists of the set of multiplicative units of Z_{n+1}. These rows form a group under multiplication mod n. - Tom Edgar, Aug 20 2013
The pair of sequences A020652/A020653 is defined by ordering the positive fractions p/q (reduced to lowest terms) by increasing p+q, then increasing p: 1/1; 1/2, 2/1; 1/3, 3/1; 1/4, 2/3, 3/2, 4/1; 1/5, 5/1; 2/5, 3/4, 4/3, 5/2; etc. For given p+q, there are A000010(p+q) fractions, listed starting at index A002088(p+q-1). - M. F. Hasler, Mar 06 2020

Examples

			Arrange positive fractions < 1 by increasing denominator then by increasing numerator: 1/2, 1/3, 2/3, 1/4, 3/4, 1/5, 2/5, 3/5, 4/5, 1/6 ... (this is A020652/A038567). - _William Rex Marshall_, Dec 16 2010
		

References

  • S. Cook, Problem 511: An Enumeration Problem, Journal of Recreational Mathematics, Vol. 9:2 (1976-77), 137. Solution by the Problem Editor, JRM, Vol. 10:2 (1977-78), 122-123.
  • Richard Courant and Herbert Robbins. What Is Mathematics?, Oxford, 1941, pp. 79-80.
  • H. Lauwerier, Fractals, Princeton Univ. Press, p. 23.

Crossrefs

Essentially the same as A038566, which is the main entry for this sequence.
A054424 gives mapping to Stern-Brocot tree.
Cf. A037161.

Programs

  • Haskell
    a020652 n = a020652_list !! (n-1)
    a020652_list = map fst [(u,v) | v <- [1..], u <- [1..v-1], gcd u v == 1]
    -- Reinhard Zumkeller, Jul 29 2012
    
  • Maple
    with (numtheory): A020652 := proc (n) local sum, j, k; sum := 0: k := 2: while (sum < n) do: sum := sum + phi(k): k := k + 1: od: sum := sum - phi(k-1): j := 1; while sum < n do: if gcd(j,k-1) = 1 then sum := sum + 1: fi: j := j+1: od: RETURN (j-1): end: # Ulrich Schimke (ulrschimke(AT)aol.com), Nov 06 2001
  • Mathematica
    Reap[Do[If[GCD[num, den] == 1, Sow[num]], {den, 1, 20}, {num, 1, den-1}] ][[2, 1]] (* Jean-François Alcover, Oct 22 2012 *)
  • PARI
    a(n)=my(s,j=1,k=1);while(sCharles R Greathouse IV, Feb 07 2013
    
  • Python
    from sympy import totient, gcd
    def a(n):
        s=0
        k=2
        while sIndranil Ghosh, May 23 2017, after Ulrich Schimke's MAPLE code

A226314 Triangle read by rows: T(i,j) = j+(i-j)/gcd(i,j) (1<=i<=j).

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 1, 3, 3, 4, 1, 2, 3, 4, 5, 1, 4, 5, 5, 5, 6, 1, 2, 3, 4, 5, 6, 7, 1, 5, 3, 7, 5, 7, 7, 8, 1, 2, 7, 4, 5, 8, 7, 8, 9, 1, 6, 3, 7, 9, 8, 7, 9, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 7, 9, 10, 5, 11, 7, 11, 11, 11, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 8, 3, 9, 5, 10, 13, 11, 9, 12, 11, 13, 13, 14
Offset: 1

Views

Author

N. J. A. Sloane, Jun 09 2013

Keywords

Comments

The triangle of fractions A226314(i,j)/A054531(i,j) is an efficient way to enumerate the rationals [Fortnow].
Sum(A226314(n,k)/A054531(n,k): 1<=k<=n) = A226555(n)/A040001(n). - Reinhard Zumkeller, Jun 10 2013

Examples

			Triangle begins:
[1]
[1, 2]
[1, 2, 3]
[1, 3, 3, 4]
[1, 2, 3, 4, 5]
[1, 4, 5, 5, 5, 6]
[1, 2, 3, 4, 5, 6, 7]
[1, 5, 3, 7, 5, 7, 7, 8]
[1, 2, 7, 4, 5, 8, 7, 8, 9]
[1, 6, 3, 7, 9, 8, 7, 9, 9, 10]
...
The resulting triangle of fractions begins:
1,
1/2, 2,
1/3, 2/3, 3,
1/4, 3/2, 3/4, 4,
1/5, 2/5, 3/5, 4/5, 5,
...
		

Crossrefs

Programs

  • Haskell
    a226314 n k = n - (n - k) `div` gcd n k
    a226314_row n = a226314_tabl !! (n-1)
    a226314_tabl = map f $ tail a002262_tabl where
       f us'@(_:us) = map (v -) $ zipWith div vs (map (gcd v) us)
         where (v:vs) = reverse us'
    -- Reinhard Zumkeller, Jun 10 2013
  • Maple
    f:=(i,j) -> j+(i-j)/gcd(i,j);
    g:=n->[seq(f(i,n),i=1..n)];
    for n from 1 to 20 do lprint(g(n)); od:

A037162 Well-order the rational numbers; take denominators.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 3, 4, 4, 3, 2, 1, 1, 5, 5, 1, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 1, 3, 5, 7, 7, 5, 3, 1, 1, 2, 4, 5, 7, 8, 8, 7, 5, 4, 2, 1, 1, 3, 7, 9, 9, 7, 3, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
Offset: 0

Views

Author

Keywords

References

  • Sierpiński, Cardinal and Ordinal Numbers, Warsaw 1965, 2nd ed., p. 40.

Crossrefs

Cf. A037161.
Cf. A038567.

Programs

  • Haskell
    import Data.List (transpose)
    import Data.Ratio ((%), denominator)
    a037162 n = a037162_list !! n
    a037162_list = 1 : map denominator
      (concat $ concat $ transpose [map (map negate) qss, map reverse qss])
      where qss = map q [1..]
            q x = map (uncurry (%)) $ filter ((== 1) . uncurry gcd) $
                      zip (reverse zs) zs where zs = [1..x]
    -- Reinhard Zumkeller, Mar 08 2013
  • Mathematica
    order[n_] := Join[-Reverse[ pos = Select[(r = Range[n])/Reverse[r], Numerator[#] + Denominator[#] == n + 1 & ] ], pos]; order[0] = 0; Denominator[ Flatten[ Table[ order[n], {n, 0, 10}]]] (* Jean-François Alcover, Jun 27 2012 *)
Showing 1-3 of 3 results.