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.

A196189 Smallest number not yet in the sequence greater than n+1 and relatively prime to n.

Original entry on oeis.org

3, 5, 7, 9, 8, 11, 10, 13, 14, 17, 15, 19, 16, 23, 22, 21, 20, 25, 24, 27, 26, 29, 28, 31, 32, 33, 34, 37, 35, 41, 36, 39, 38, 43, 44, 47, 40, 45, 46, 49, 48, 53, 50, 51, 52, 55, 54, 59, 57, 61, 56, 63, 58, 65, 62, 67, 64, 69, 66, 71, 68, 73, 74, 75, 72, 79, 70, 77, 76
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A169190, A065190 (if condition a(n) > n dropped).

Programs

  • Haskell
    a196189 n = a196189_list !! (n-1)
    a196189_list = f 1 [] where
       f n xs = x : f (n+1) (x:xs) where
         x = head [z | z <- [n+2..], z `notElem` xs, gcd z n == 1]
    -- Reinhard Zumkeller, Sep 29 2011
  • PARI
    invecn(v,n,x)=for(k=1,n,if(v[k]==x,return(k)));0
    nexta(v,n)=local(k=n+2);while(gcd(k,n)>1||invecn(v,n-1,k),k++);k
    al(n)=local(v=vector(n));for(k=1,n,v[k]=nexta(v,k));v