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.

A077664 Triangle in which the n-th row contains n smallest numbers greater than n and coprime to n.

Original entry on oeis.org

2, 3, 5, 4, 5, 7, 5, 7, 9, 11, 6, 7, 8, 9, 11, 7, 11, 13, 17, 19, 23, 8, 9, 10, 11, 12, 13, 15, 9, 11, 13, 15, 17, 19, 21, 23, 10, 11, 13, 14, 16, 17, 19, 20, 22, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47
Offset: 1

Views

Author

Amarnath Murthy, Nov 14 2002

Keywords

Comments

A260910 gives the triangle of Frobenius numbers of n, T(n,k). - Reinhard Zumkeller, Aug 04 2015

Examples

			Triangle begins:
  2;
  3,  5;
  4,  5,  7;
  5,  7,  9, 11;
  6,  7,  8,  9, 11;
  7, 11, 13, 17, 19, 23;
  8,  9, 10, 11, 12, 13, 15;
  ...
		

Crossrefs

Cf. A077581, A260895 (number of primes per row), A260910.

Programs

  • Haskell
    a077664 n k = a077664_tabl !! (n-1) !! (k-1)
    a077664_row n = a077664_tabl !! (n-1)
    a077664_tabl = map (\x -> take x $ filter ((== 1). gcd x) [x + 1 ..]) [1..]
    -- Reinhard Zumkeller, Aug 03 2015
    
  • Mathematica
    T[n_] := Module[{j, k}, Reap[For[j = n+1; k = 1, k <= n, j++, If[CoprimeQ[n, j], Sow[j]; k++]]][[2, 1]]];
    Table[T[n], {n, 1, 12}] // Flatten (* Jean-François Alcover, Sep 21 2021 *)
  • Python
    from math import gcd
    def arow(n):
        rown, k = [], n + 1
        while len(rown) < n:
            if gcd(k, n) == 1: rown.append(k)
            k += 1
        return rown
    def agen(rows):
        for n in range(1, rows+1): yield from arow(n)
    print([an for an in agen(12)]) # Michael S. Branicky, Sep 21 2021

Extensions

More terms from Sascha Kurz, Jan 03 2003