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

A053669 Smallest prime not dividing n.

Original entry on oeis.org

2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 7, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 7, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 7, 2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2
Offset: 1

Views

Author

Henry Bottomley, Feb 15 2000

Keywords

Comments

Smallest prime coprime to n.
Smallest k >= 2 coprime to n.
a(#(p-1)) = a(A034386(p-1)) = p is the first appearance of prime p in sequence.
a(A005408(n)) = 2; for n > 2: a(n) = A112484(n,1). - Reinhard Zumkeller, Sep 23 2011
Average value is 2.920050977316134... = A249270. - Charles R Greathouse IV, Nov 02 2013
Differs from A236454, "smallest number not dividing n^2", for the first time at n=210, where a(210)=11 while A236454(210)=8. A235921 lists all n for which a(n) differs from A236454. - Antti Karttunen, Jan 26 2014
For k >= 0, a(A002110(k)) is the first occurrence of p = prime(k+1). Thereafter p occurs whenever A007947(n) = A002110(k). Thus every prime appears in this sequence infinitely many times. - David James Sycamore, Dec 04 2024

Examples

			a(60) = 7, since all primes smaller than 7 divide 60 but 7 does not.
a(90) = a(120) = a(150) = a(180) = 7 because 90,120,150,180 all have same squarefree kernel = 30 = A002110(3), and 7 is the smallest prime which does not divide 30. - _David James Sycamore_, Dec 04 2024
		

Crossrefs

Programs

  • Haskell
    a053669 n = head $ dropWhile ((== 0) . (mod n)) a000040_list
    -- Reinhard Zumkeller, Nov 11 2012
    
  • Maple
    f:= proc(n) local p;
    p:= 2;
    while n mod p = 0 do p:= nextprime(p) od:
    p
    end proc:
    map(f, [$1..100]); # Robert Israel, May 18 2016
  • Mathematica
    Table[k := 1; While[Not[GCD[n, Prime[k]] == 1], k++ ]; Prime[k], {n, 1, 60}] (* Stefan Steinerberger, Apr 01 2006 *)
    With[{prs=Prime[Range[10]]},Flatten[Table[Select[prs,!Divisible[ n,#]&,1],{n,110}]]] (* Harvey P. Dale, May 03 2012 *)
  • PARI
    a(n)=forprime(p=2,,if(n%p,return(p))) \\ Charles R Greathouse IV, Nov 20 2012
    
  • Python
    from sympy import nextprime
    def a(n):
        p = 2
        while True:
            if n%p: return p
            else: p=nextprime(p) # Indranil Ghosh, May 12 2017
    
  • Python
    # using standard library functions only
    import math
    def a(n):
        k = 2
        while math.gcd(n,k) > 1: k += 1
        return k # Ely Golden, Nov 26 2020
  • Scheme
    (define (A053669 n) (let loop ((i 1)) (cond ((zero? (modulo n (A000040 i))) (loop (+ i 1))) (else (A000040 i))))) ;; Antti Karttunen, Jan 26 2014
    

Formula

a(n) = A071222(n-1)+1. [Because the right hand side computes the smallest k >= 2 such that gcd(n,k) = gcd(n-1,k-1) which is equal to the smallest k >= 2 coprime to n] - Antti Karttunen, Jan 26 2014
a(n) = 1 + Sum_{k=1..n}(floor((n^k)/k!)-floor(((n^k)-1)/k!)) = 2 + Sum_{k=1..n} A001223(k)*( floor(n/A002110(k))-floor((n-1)/A002110(k)) ). - Anthony Browne, May 11 2016
a(n!) = A151800(n). - Anthony Browne, May 11 2016
a(2k+1) = 2. - Bernard Schott, Jun 03 2019
Asymptotic mean: lim_{n->oo} (1/n) * Sum_{k=1..n} a(k) = A249270. - Amiram Eldar, Oct 29 2020
a(n) = A000040(A257993(n)) = A020639(A276086(n)) = A276086(n) / A324895(n). - Antti Karttunen, Apr 24 2022
a(n) << log n. For every e > 0, there is some N such that for all n > N, a(n) < (1 + e)*log n. - Charles R Greathouse IV, Dec 03 2022
A007947(n) = A002110(k) ==> a(n) = prime(k+1). - David James Sycamore, Dec 04 2024

Extensions

More terms from Andrew Gacek (andrew(AT)dgi.net), Feb 21 2000 and James Sellers, Feb 22 2000
Entry revised by David W. Wilson, Nov 25 2006

A053674 Least number coprime to n, n+1, n+2, n+3, n+4 and n+5.

Original entry on oeis.org

7, 11, 11, 11, 11, 13, 13, 7, 17, 17, 17, 11, 11, 11, 7, 11, 13, 13, 13, 13, 17, 7, 11, 11, 11, 11, 11, 13, 7, 13, 13, 13, 13, 11, 11, 7, 11, 11, 17, 13, 13, 13, 7, 13, 11, 11, 11, 11, 11, 7, 19, 17, 13, 13, 13, 11, 7, 11, 11, 11, 17, 17, 19, 7, 19, 13, 11, 11, 11, 11, 7, 13
Offset: 1

Views

Author

Henry Bottomley, Feb 15 2000

Keywords

Comments

All terms are primes greater than 5. Records: a(1) = 7, a(2) = 11, a(6) = 13, a(9) = 17, a(51) = 19, a(151) = 23, a(437) = 29, a(779) = 31, a(1766) = 37, a(60605) = 41, a(324596) = 43, a(3555107) = 47, a(14511250) = 53, a(65209022) = 59, a(764050703) = 61, .... - Charles R Greathouse IV, Feb 07 2017

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (fromJust)
    a053674 n = 2 + fromJust
       (elemIndex 1 $ map (gcd $ foldl1 lcm $ take 6 [n..]) [2..])
    -- Reinhard Zumkeller, Sep 25 2011
    
  • Mathematica
    a[n_] := (k = 7; While[ ! And @@ (CoprimeQ[k, #] & ) /@ Range[n, n+5], k++]; k); Table[a[n], {n, 1, 72}] (* Jean-François Alcover, Nov 30 2011 *)
    cpr[n_]:=Module[{k=7},While[Union[Boole[CoprimeQ[k,n+Range[0,5]]]]!={1},k = NextPrime[ k]];k](* Harvey P. Dale, May 12 2022 *)
  • PARI
    a(n)=my(L=lcm([n..n+5])); forprime(p=7,, if(L%p, return(p))) \\ Charles R Greathouse IV, Feb 07 2017

Extensions

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

A090093 a(n) is the smallest composite number coprime to n, n+1, n+2, n+3.

Original entry on oeis.org

25, 49, 49, 121, 121, 25, 121, 49, 49, 49, 25, 121, 121, 121, 49, 25, 49, 121, 169, 169, 25, 49, 49, 49, 121, 25, 121, 121, 49, 49, 25, 169, 169, 121, 121, 25, 49, 49, 121, 121, 25, 169, 49, 49, 49, 25, 121, 121, 121, 49, 25, 49, 169, 169, 169, 25, 49, 49, 49, 121, 25
Offset: 1

Views

Author

Labos Elemer, Nov 26 2003

Keywords

Crossrefs

Programs

  • Mathematica
    m=0;Table[fla=1;Do[s=GCD[n, k];s1=GCD[n, k+1]; s2=GCD[n, k+2];s3=GCD[n, k+3];If[Equal[s, 1]&&Equal[s1, 1] &&Equal[s2, 1]&&Equal[s3, 1]&&!PrimeQ[n]&&!Equal[n, 1] &&Equal[fla, 1], m=m+1;Print[n];fla=0], {n, 1, 1000}], {k, 1, 256}]
    With[{compnos=Complement[Range[2,500],Prime[Range[PrimePi[500]]]]}, Table[ First[Select[compnos,And@@CoprimeQ[#,n+Range[0,3]]&]],{n,70}]] (* Harvey P. Dale, Aug 10 2011 *)

Formula

a(n) = A053672(n)^2.

A090092 a(n) is the smallest composite number coprime to n, n+1 and n+2.

Original entry on oeis.org

25, 25, 49, 49, 121, 25, 25, 49, 49, 49, 25, 25, 121, 121, 49, 25, 25, 49, 121, 169, 25, 25, 49, 49, 49, 25, 25, 121, 49, 49, 25, 25, 169, 121, 121, 25, 25, 49, 49, 121, 25, 25, 49, 49, 49, 25, 25, 121, 121, 49, 25, 25, 49, 169, 169, 25, 25, 49, 49, 49, 25, 25, 121, 49, 49, 25
Offset: 1

Views

Author

Labos Elemer, Nov 26 2003

Keywords

Crossrefs

Programs

  • Mathematica
    m=0;Table[fla=1;Do[s=GCD[n, k];s1=GCD[n, k+1]; s2=GCD[n, k+2];s3=GCD[n, k+3]; If[Equal[s, 1]&&Equal[s1, 1]&&Equal[s2, 1] &&!PrimeQ[n]&&!Equal[n, 1] &&Equal[fla, 1], m=m+1;Print[n];fla=0], {n, 1, 1000}], {k, 1, 256}]
    nn=200;With[{c=Complement[Range[2,nn],Prime[Range[PrimePi[nn]]]]}, Flatten[ Table[ Select[c,And@@Thread[CoprimeQ[{n,n+1,n+2},#]]&,1],{n,nn}]]](* Harvey P. Dale, Sep 28 2013 *)

Formula

a(n) = A053671(n)^2.

A090095 a(n) is the smallest composite number coprime to n, n+1, n+2, n+3, n+4 and n+5.

Original entry on oeis.org

49, 121, 121, 121, 121, 169, 169, 49, 289, 289, 289, 121, 121, 121, 49, 121, 169, 169, 169, 169, 289, 49, 121, 121, 121, 121, 121, 169, 49, 169, 169, 169, 169, 121, 121, 49, 121, 121, 289, 169, 169, 169, 49, 169, 121, 121, 121, 121, 121, 49, 361, 289, 169, 169
Offset: 1

Views

Author

Labos Elemer, Nov 26 2003

Keywords

Crossrefs

Programs

  • Mathematica
    m=0;Table[fla=1;Do[s=GCD[n, k];s1=GCD[n, k+1]; s2=GCD[n, k+2];s3=GCD[n, k+3];s4=GCD[n, k+4];s5=GCD[n, k+5]; If[Equal[s, 1]&&Equal[s1, 1]&&Equal[s2, 1]&&Equal[s3, 1]&& Equal[s4, 1]&&Equal[s5, 1]&&!PrimeQ[n]&&!Equal[n, 1]&&Equal[fla, 1], m=m+1;Print[n];fla=0], {n, 1, 1000}], {k, 1, 256}]
    scn[n_]:=Module[{k=4,c=n+Range[0,5]},While[PrimeQ[k]||!AllTrue[c,CoprimeQ[ k,#]&],k++];k]; Array[scn,60] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 30 2020 *)

Formula

a(n) = A053674(n)^2.

A090094 a(n) is the smallest composite number coprime to n, n+1, n+2, n+3 and n+4.

Original entry on oeis.org

49, 49, 121, 121, 121, 121, 169, 49, 49, 289, 289, 121, 121, 121, 49, 49, 121, 169, 169, 169, 169, 49, 49, 121, 121, 121, 121, 121, 49, 49, 169, 169, 169, 121, 121, 49, 49, 121, 121, 169, 169, 169, 49, 49, 121, 121, 121, 121, 121, 49, 49, 289, 169, 169, 169, 121, 49
Offset: 1

Views

Author

Labos Elemer, Nov 26 2003

Keywords

Crossrefs

Programs

  • Mathematica
    m=0;Table[fla=1;Do[s=GCD[n, k];s1=GCD[n, k+1]; s2=GCD[n, k+2];s3=GCD[n, k+3];s4=GCD[n, k+4];s5=GCD[n, k+5]; If[Equal[s, 1]&&Equal[s1, 1]&&Equal[s2, 1]&&Equal[s3, 1]&& Equal[s4, 1]&&!PrimeQ[n]&&!Equal[n, 1]&&Equal[fla, 1], m=m+1;Print[n];fla=0], {n, 1, 1000}], {k, 1, 256}]
    scn[n_]:=Module[{cn=4},While[!CompositeQ[cn]||!And@@CoprimeQ[ Range[ n,n+4], cn], cn++]; cn]; Array[scn,60] (* Harvey P. Dale, Aug 12 2014 *)

Formula

a(n) = A053673(n)^2.

A089091 a(n) is the smallest composite number coprime to n and n+1.

Original entry on oeis.org

9, 25, 25, 9, 49, 25, 9, 25, 49, 9, 25, 25, 9, 121, 49, 9, 25, 25, 9, 121, 25, 9, 25, 49, 9, 25, 25, 9, 49, 49, 9, 25, 25, 9, 121, 25, 9, 25, 49, 9, 25, 25, 9, 49, 49, 9, 25, 25, 9, 49, 25, 9, 25, 49, 9, 25, 25, 9, 49, 49, 9, 25, 25, 9, 49, 25, 9, 25, 121, 9, 25, 25, 9, 49, 49, 9, 25, 25
Offset: 1

Views

Author

Labos Elemer, Nov 26 2003

Keywords

Crossrefs

Programs

  • Mathematica
    m=0;Table[fla=1;Do[s=GCD[n, k]; s1=GCD[n, k+1];s2=GCD[n, k+2];s3=GCD[n, k+3]; If[Equal[s, 1]&&Equal[s1, 1]&&!PrimeQ[n]&&!Equal[n, 1]&& Equal[fla, 1], m=m+1;Print[n];fla=0], {n, 1, 1000}], {k, 1, 256}]
  • Python
    from math import gcd
    def a(n):
        k, m = 3, n*(n+1)
        while gcd(k, m) != 1: k += 2
        return k*k
    print([a(n) for n in range(1, 79)]) # Michael S. Branicky, Sep 25 2021

Formula

a(n) = A053670(n)^2.

Extensions

Offset corrected by Mohammed Yaseen, Aug 15 2023
Showing 1-7 of 7 results.