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.

A071222 Smallest k such that gcd(n,k) = gcd(n+1,k+1).

Original entry on oeis.org

1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2
Offset: 0

Views

Author

Benoit Cloitre, Jun 10 2002

Keywords

Comments

a(n) = least m>0 such that gcd(n!+1+m,n-m) = 1. [Clark Kimberling, Jul 21 2012]
From Antti Karttunen, Jan 26 2014: (Start)
a(n-1)+1 = A053669(n) = Smallest k >= 2 coprime to n = Smallest prime not dividing n.
Note that a(n) is equal to A235918(n+1) for the first 209 values of n. The first difference occurs at n=210 and A235921 lists the integers n for which a(n) differs from A235918(n+1).
(End)

Crossrefs

One less than A053669(n+1).

Programs

  • Haskell
    a071222 n = head [k | k <- [1..], gcd (n + 1) (k + 1) == gcd n k]
    -- Reinhard Zumkeller, Oct 01 2014
  • Mathematica
    sgcd[n_]:=Module[{k=1},While[GCD[n,k]!=GCD[n+1,k+1],k++];k]; Array[sgcd,110] (* Harvey P. Dale, Jul 13 2012 *)
  • PARI
    for(n=1,140,s=1; while(gcd(s,n)
    				
  • Scheme
    (define (A071222 n) (let loop ((k 1)) (cond ((= (gcd n k) (gcd (+ n 1) (+ k 1))) k) (else (loop (+ 1 k)))))) ;; Antti Karttunen, Jan 26 2014
    

Formula

Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A249270 - 1. - Amiram Eldar, Jul 26 2022

Extensions

Added a(0)=1. - N. J. A. Sloane, Jan 19 2014