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-4 of 4 results.

A182972 Numerators of positive rationals < 1 arranged by increasing sum of numerator and denominator then by increasing numerator.

Original entry on oeis.org

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

Views

Author

William Rex Marshall, Dec 16 2010

Keywords

Comments

A023022(n) and A245677(n) give number and numerator of sum of fractions a(k)/A182973(k) such that a(k) + A182973(k) = n. - Reinhard Zumkeller, Jul 30 2014

Examples

			Positive fractions < 1 listed by increasing sum of numerator and denominator, and by increasing numerator for equal sums:
1/2
1/3
1/4 2/3
1/5
1/6 2/5 3/4
1/7 3/5
1/8 2/7 4/5
1/9 3/7
1/10 2/9 3/8 4/7 5/6
1/11 5/7
1/12 2/11 3/10 4/9 5/8 6/7
1/13 3/11 5/9
1/14 2/13 4/11 7/8
1/15 3/13 5/11 7/9
1/16 2/15 3/14 4/13 5/12 6/11 7/10 8/9
1/17 5/13 7/11
1/18 2/17 3/16 4/15 5/14 6/13 7/12 8/11 9/10
1/19 3/17 7/13 9/11
(this is A182972/A182973).
		

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.
  • R. K. Guy, Unsolved Problems in Number Theory (UPINT), Section D11.

Crossrefs

Cf. A182973 (denominators), A366191 (interleaved).
Essentially the same as A333856.

Programs

  • Haskell
    a182972 n = a182972_list !! (n-1)
    a182972_list = map fst $ concatMap q [3..] where
       q x = [(num, den) | num <- [1 .. div x 2],
                           let den = x - num, gcd num den == 1]
    -- Reinhard Zumkeller, Jul 29 2014
    
  • Maple
    t1:=[];
    for n from 2 to 40 do
    t1:=[op(t1),1/(n-1)];
    for i from 2 to floor((n-1)/2) do
       if gcd(i,n-i)=1 then t1:=[op(t1),i/(n-i)]; fi; od:
    od:
    t1;
  • Mathematica
    t1={}; For[n=2, n <= 40, n++, AppendTo[t1, 1/(n-1)]; For[i=2, i <= Floor[(n-1)/2], i++, If[GCD[i, n-i] == 1, AppendTo[t1, i/(n-i)]]]]; t1 // Numerator // Rest (* Jean-François Alcover, Jan 20 2015, translated from Maple *)
  • Pascal
    program a182972;
    var
      num,den,n: longint;
    function gcd(i,j: longint):longint;
    begin
      repeat
        if i>j then i:=i mod j else j:=j mod i;
      until (i=0) or (j=0);
      if i=0 then gcd:=j else gcd:=i;
    end;
    begin
      num:=1; den:=1; n:=0;
      repeat
        repeat
          inc(num); dec(den);
          if num>=den then
          begin
            inc(den,num); num:=1;
          end;
        until gcd(num,den)=1;
        inc(n); writeln(n,' ',num);
      until n=100000;
    end.
    
  • Python
    from itertools import count, islice
    from math import gcd
    def A182972_gen(): # generator of terms
        return (i for n in count(2) for i in range(1,1+(n-1>>1)) if gcd(i,n-i)==1)
    A182972_list = list(islice(A182972_gen(),10)) # Chai Wah Wu, Aug 28 2023

Extensions

Corrected by William Rex Marshall, Aug 12 2013

A182973 Denominators of positive rationals < 1 arranged by increasing sum of numerator and denominator then by increasing numerator.

Original entry on oeis.org

2, 3, 4, 3, 5, 6, 5, 4, 7, 5, 8, 7, 5, 9, 7, 10, 9, 8, 7, 6, 11, 7, 12, 11, 10, 9, 8, 7, 13, 11, 9, 14, 13, 11, 8, 15, 13, 11, 9, 16, 15, 14, 13, 12, 11, 10, 9, 17, 13, 11, 18, 17, 16, 15, 14, 13, 12, 11, 10, 19, 17, 13, 11, 20, 19, 17, 16, 13, 11, 21, 19, 17, 15, 13, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12
Offset: 1

Views

Author

William Rex Marshall, Dec 16 2010

Keywords

Comments

A023022(n) and A245678(n) give number and denominator of sum of fractions A182972(k)/a(k) such that A182972(k) + a(k) = n. - Reinhard Zumkeller, Jul 30 2014

Examples

			Positive fractions < 1 listed by increasing sum of numerator and denominator, and by increasing numerator for equal sums:
1/2, 1/3, 1/4, 2/3, 1/5, 1/6, 2/5, 3/4, 1/7, 3/5, 1/8, 2/7, 4/5, 1/9, 3/7, ...
(this is A182972/A182973).
		

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.
  • R. K. Guy, Unsolved Problems in Number Theory (UPINT), Section D11.

Crossrefs

Cf. A182972 (numerators), A366191 (interleaved).

Programs

  • Haskell
    a182973 n = a182973_list !! (n-1)
    a182973_list = map snd $ concatMap q [3..] where
       q x = [(num, den) | num <- [1 .. div x 2],
                           let den = x - num, gcd num den == 1]
    -- Reinhard Zumkeller, Jul 29 2014
    
  • Mathematica
    A182973list[s_] := Table[If[CoprimeQ[num, s-num], s-num, Nothing], {num, Floor[s/2]}]; Flatten[Array[A182973list, 25, 3]] (* Paolo Xausa, Feb 27 2024 *)
  • Pascal
    program a182973;
    var
      num,den,n: longint;
    function gcd(i,j: longint):longint;
    begin
      repeat
        if i>j then i:=i mod j else j:=j mod i;
      until (i=0) or (j=0);
      if i=0 then gcd:=j else gcd:=i;
    end;
    begin
      num:=1; den:=1; n:=0;
      repeat
        repeat
          inc(num); dec(den);
          if num>=den then
          begin
            inc(den,num); num:=1;
          end;
        until gcd(num,den)=1;
        inc(n); writeln(n,' ',den);
      until n=100000;
    end.
    
  • Python
    from itertools import count, islice
    from math import gcd
    def A182973_gen(): # generator of terms
        return (n-i for n in count(2) for i in range(1,1+(n-1>>1)) if gcd(i,n-i)==1)
    A182973_list = list(islice(A182973_gen(),10)) # Chai Wah Wu, Aug 28 2023

A245718 Integer part of sum of fractions A182972(k) / A182973(k) such that A182972(k) + A182973(k) = n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jul 30 2014

Keywords

Comments

A245718(n) = floor(A245677(n)/A245678(n)).

Examples

			 See A245677.
		

Crossrefs

Programs

  • Haskell
    a245718 n = a245677 n `div` a245678 n

A245677 Numerator of sum of fractions A182972(k) / A182973(k) such that A182972(k) + A182973(k) = n.

Original entry on oeis.org

1, 1, 11, 1, 79, 26, 339, 34, 5297, 62, 69071, 1165, 11723, 9844, 471181, 2625, 8960447, 73244, 8231001, 243757, 1031626241, 151100, 4178462515, 2651758, 10396147563, 11843614, 64166447971, 362476, 1989542332021, 97275764008, 1830230212061, 57286319768
Offset: 3

Views

Author

Reinhard Zumkeller, Jul 30 2014

Keywords

Comments

A182972(n) and A182973(n) provide an enumeration of positive rationals < 1 arranged by increasing sum of numerator and denominator then by increasing numerator;
a(n) = numerator(sum(A182972(k)/A182973(k): k such that A182972(k)+A182973(k)=n));
A245718(n) = floor(a(n)/A245678(n)).

Examples

			.     |  (num, den) = (A182973, A182973) | num(sum)| den(sum)|   [sum]
.   n |  num/den,   num + den = n        | A245677 | A245678 | A245718
. ----+----------------------------------+---------+---------+--------
.   3 |  1/2                             |       1 |       2 |       0
.   4 |  1/3                             |       1 |       3 |       0
.   5 |  1/4, 2/3                        |      11 |      12 |       0
.   6 |  1/5                             |       1 |       5 |       0
.   7 |  1/6, 2/5, 3/4                   |      79 |      60 |       1
.   8 |  1/7, 3/5                        |      26 |      35 |       0
.   9 |  1/8, 2/7, 4/5                   |     339 |     280 |       1
.  10 |  1/9, 3/7                        |      34 |      63 |       0
.  11 |  1/10, 2/9, 3/8, 4/7, 5/6        |    5297 |    2520 |       2
.  12 |  1/11, 5/7                       |      62 |      77 |       0
.  13 |  1/12, 2/11, 3/10, 4/9, 5/8, 6/7 |   69071 |   27720 |       2
.  14 |  1/13, 3/11, 5/9                 |    1165 |    1287 |       0
.  15 |  1/14, 2/13, 4/11, 7/8           |   11723 |    8008 |       1
.  16 |  1/15, 3/13, 5/11, 7/9           |    9844 |    6435 |       1 .
		

Crossrefs

Cf. A245678 (denominator), A182972, A182973, A245718.

Programs

  • Haskell
    import Data.Ratio ((%), numerator)
    a245677 n = numerator $ sum
       [num % den | num <- [1 .. div n 2], let den = n - num, gcd num den == 1]
Showing 1-4 of 4 results.