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.

A053670 Least number coprime to n and n+1.

Original entry on oeis.org

3, 5, 5, 3, 7, 5, 3, 5, 7, 3, 5, 5, 3, 11, 7, 3, 5, 5, 3, 11, 5, 3, 5, 7, 3, 5, 5, 3, 7, 7, 3, 5, 5, 3, 11, 5, 3, 5, 7, 3, 5, 5, 3, 7, 7, 3, 5, 5, 3, 7, 5, 3, 5, 7, 3, 5, 5, 3, 7, 7, 3, 5, 5, 3, 7, 5, 3, 5, 11, 3, 5, 5, 3, 7, 7, 3, 5, 5, 3, 7, 5, 3, 5, 11, 3, 5, 5, 3, 7, 11, 3, 5, 5, 3, 7, 5, 3, 5, 7, 3, 5
Offset: 1

Views

Author

Henry Bottomley, Feb 15 2000

Keywords

Comments

A179675(n) = smallest m such that a(m) = n-th odd prime. - Reinhard Zumkeller, Jul 23 2010

Crossrefs

Programs

  • Haskell
    a053670 n = head [x | x <- [3, 5 ..],
                          n `gcd` x == 1, (n + 1) `gcd` x == 1]
    -- Reinhard Zumkeller, Dec 28 2012
    
  • Mathematica
    a[n_] := For[k = 3, True, k++, If[CoprimeQ[k, n, n+1], Return[k]]]; Table[a[n], {n, 1, 101}] (* Jean-François Alcover, Sep 20 2012 *)
  • PARI
    a(n)=my(N=n*(n+1),k=2); while(gcd(k++,N)>1,); k \\ Charles R Greathouse IV, Nov 10 2015
    
  • Python
    from math import gcd
    def a(n):
        k, m = 3, n*(n+1)
        while gcd(k, m) != 1: k += 2
        return k
    print([a(n) for n in range(1, 102)]) # Michael S. Branicky, Sep 25 2021

Extensions

More terms from Andrew Gacek (andrew(AT)dgi.net), Feb 21 2000 and James Sellers, Feb 22 2000