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-4 of 4 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

A038566 Numerators in canonical bijection from positive integers to positive rationals <= 1: arrange fractions by increasing denominator then by increasing numerator.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 1, 2, 3, 4, 1, 5, 1, 2, 3, 4, 5, 6, 1, 3, 5, 7, 1, 2, 4, 5, 7, 8, 1, 3, 7, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 5, 7, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 3, 5, 9, 11, 13, 1, 2, 4, 7, 8, 11, 13, 14, 1, 3, 5, 7, 9, 11, 13, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
Offset: 1

Views

Author

Keywords

Comments

For denominators see A038567.
Row n has length A000010(n).
Also numerators in canonical bijection from positive integers to all positive rational numbers: arrange fractions in triangle in which in the n-th row the phi(n) numbers are the fractions i/j with gcd(i,j) = 1, i+j=n, i=1..n-1, j=n-1..1. n>=2. Denominators (A020653) are obtained by reversing each row.
Also triangle in which n-th row gives phi(n) numbers between 1 and n that are relatively prime to n.
A038610(n) = least common multiple of n-th row. - Reinhard Zumkeller, Sep 21 2013
Row n has sum A023896(n). - Jamie Morken, Dec 17 2019
This irregular triangle gives in row n the smallest positive reduced residue system modulo n, for n >= 1. If one takes 0 for n = 1 it becomes the smallest nonnegative residue system modulo n. - Wolfdieter Lang, Feb 29 2020

Examples

			The beginning of the list of positive rationals <= 1: 1/1, 1/2, 1/3, 2/3, 1/4, 3/4, 1/5, 2/5, 3/5, .... This is A038566/A038567.
The beginning of the triangle giving all positive rationals: 1/1; 1/2, 2/1; 1/3, 3/1; 1/4, 2/3, 3/2, 4/1; 1/5, 5/1; 1/6, 2/5, 3/4, 4/3, 5/2, 6/1; .... This is A020652/A020653, with A020652(n) = A038566(n+1). [Corrected by _M. F. Hasler_, Mar 06 2020]
The beginning of the triangle in which n-th row gives numbers between 1 and n that are relatively prime to n:
n\k 1 2 3  4  5  6  7  8 9 10 11 12 13 14 15 16 17 18
1:  1
2:  1
3:  1 2
4:  1 3
5:  1 2 3  4
6:  1 5
7:  1 2 3  4  5  6
8:  1 3 5  7
9:  1 2 4  5  7  8
10: 1 3 7  9
11: 1 2 3  4  5  6  7  8 9 10
12: 1 5 7 11
13: 1 2 3  4  5  6  7  8 9 10 11 12
14: 1 3 5  9 11 13
15: 1 2 4  7  8 11 13 14
16: 1 3 5  7  9 11 13 15
17: 1 2 3  4  5  6  7  8 9 10 11 12 13 14 15 16
18: 1 5 7 11 13 17
19: 1 2 3  4  5  6  7  8 9 10 11 12 13 14 15 16 17 18
20: 1 3 7  9 11 13 17 19
... Reformatted. - _Wolfdieter Lang_, Jan 18 2017
------------------------------------------------------
		

References

  • Richard Courant and Herbert Robbins. What Is Mathematics?, Oxford, 1941, pp. 79-80.
  • H. Lauwerier, Fractals, Princeton Univ. Press, p. 23.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 163.

Crossrefs

A054424 gives mapping to Stern-Brocot tree.
Row sums give rationals A111992(n)/A069220(n), n>=1.
A112484 (primes, rows n >=3).

Programs

  • Haskell
    a038566 n k = a038566_tabf !! (n-1) !! (k-1)
    a038566_row n = a038566_tabf !! (n-1)
    a038566_tabf=
       zipWith (\v ws -> filter ((== 1) . (gcd v)) ws) [1..] a002260_tabl
    a038566_list = concat a038566_tabf
    -- Reinhard Zumkeller, Sep 21 2013, Feb 23 2012
    
  • Maple
    s := proc(n) local i,j,k,ans; i := 0; ans := [ ]; for j while i
    				
  • Mathematica
    Flatten[Table[Flatten[Position[GCD[Table[Mod[j, w], {j, 1, w-1}], w], 1]], {w, 1, 100}], 2]
    row[n_]:=Select[Range[n],GCD[n,#]==1 &]; Array[row,17]//Flatten (* Stefano Spezia, Jul 20 2025 *)
  • PARI
    first(n)=my(v=List(),i,j);while(iCharles R Greathouse IV, Feb 07 2013
    
  • PARI
    row(n) = select(x->gcd(n, x)==1, [1..n]); \\ Michel Marcus, May 05 2020
    
  • SageMath
    def aRow(n):
        if n == 1: return 1
        return [k for k in ZZ(n).coprime_integers(n+1)]
    print(flatten([aRow(n) for n in range(1, 18)])) # Peter Luschny, Aug 17 2020

Formula

The n-th "clump" consists of the phi(n) integers <= n and prime to n.
a(n) = A002260(A169581(n)). - Reinhard Zumkeller, Dec 02 2009
a(n+1) = A020652(n) for n > 1. - Georg Fischer, Oct 27 2020

Extensions

More terms from Erich Friedman
Offset corrected by Max Alekseyev, Apr 26 2010

A279399 Irregular triangle read by rows. Row n gives the primes of the smallest positive restricted residue system modulo A033949(n).

Original entry on oeis.org

3, 5, 7, 5, 7, 11, 2, 7, 11, 13, 3, 5, 7, 11, 13, 3, 7, 11, 13, 17, 19, 2, 5, 11, 13, 17, 19, 5, 7, 11, 13, 17, 19, 23, 3, 5, 11, 13, 17, 19, 23, 7, 11, 13, 17, 19, 23, 29, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 2, 5, 7, 13, 17, 19, 23, 29, 31, 2, 3, 11, 13, 17, 19, 23, 29, 31, 5, 7, 11, 13, 17, 19, 23, 29, 31, 2, 5, 7, 11, 17, 19, 23, 29, 31, 37, 3, 7, 11, 13, 17, 19, 23, 29, 31, 37
Offset: 1

Views

Author

Wolfdieter Lang, Jan 25 2017

Keywords

Comments

The length of row n is given by A279400(n)
For the restricted residue systems modulo n see A038566. For the primes of A038566 (for n >= 3) see A112484.
The primes of the restricted residue system modulo the (composite) positive numbers without a primitive root, given in A033949, are of interest for the determination of the Dirichlet characters modulo the A033949 numbers. For prime numbers (A000040) or for composite positive numbers that have prime primitive roots (A279398) the Dirichlet characters are determined from those of the prime primitive root.

Examples

			The triangle T(n, k) begins (here N = A033949(n)):
n,   N \ k 1  2  3  4  5  6  7  8  9 10 ...
1,   8:    3  5  7
2,  12:    5  7 11
3,  15:    2  7 11 13
4,  16:    3  5  7 11 13
5,  20:    3  7 11 13 17 19
6,  21:    2  5 11 13 17 19
7,  24:    5  7 11 13 17 19 23
8,  28:    3  5 11 13 17 19 23
9,  30:    7 11 13 17 19 23 29
10, 32:    3  5  7 11 13 17 19 23 29 31
11, 33:    2  5  7 13 17 19 23 29 31
12, 35:    2  3 11 13 17 19 23 29 31
13, 36:    5  7 11 13 17 19 23 29 31
14, 39:    2  5  7 11 17 19 23 29 31 37
15, 40:    3  7 11 13 17 19 23 29 31 37
...
		

Crossrefs

Formula

Row n of T is given by the primes of row A033949(n) of A038566, for n >= 1.
T(n, k) = A112484(A033949(n), k), n >= 1, k = 1..A279400(n).

A285788 Irregular triangle T(n,m): nonprime 1 <= k <= n such that n and k are coprime.

Original entry on oeis.org

1, 1, 1, 1, 1, 4, 1, 1, 4, 6, 1, 1, 4, 8, 1, 9, 1, 4, 6, 8, 9, 10, 1, 1, 4, 6, 8, 9, 10, 12, 1, 9, 1, 4, 8, 14, 1, 9, 15, 1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 1, 1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 1, 9, 1, 4, 8, 10, 16, 20, 1, 9, 15, 21, 1, 4, 6, 8, 9, 10
Offset: 1

Views

Author

Michael De Vlieger, Apr 26 2017

Keywords

Comments

Row n is a subset of A038566(n) such that the union of a(n) and A112484(n) = A038566(n).
Row lengths are A048864(n) = A000010(n)-(A000720(n)-A001221(n)), i.e., phi(n)-(pi(n)-omega(n)).
1 appears in every row since 1 is not prime and coprime to all n.
4 is the smallest composite and appears first in row 5 since 4 divides 4.
Rows that contain the single term 1 are in A048597; the largest n = 30 such that the only term is 1.
For prime p, row p contains 1 and all composites k < p, since 1 < m < p are coprime to p.

Examples

			Triangle begins:
  n\m  1  2   3   4  5   6   7
   1:  1
   2:  1
   3:  1
   4:  1
   5:  1  4
   6:  1
   7:  1  4   6
   8:  1
   9:  1  4   8
  10:  1  9
  11:  1  4   6   8  9  10
  12:  1
  13:  1  4   6   8  9  10  12
  14:  1  9
  15:  1  4   8  14
  16:  1  9  15
  ...
		

Crossrefs

Programs

  • Mathematica
    Table[Select[Range@ n, And[! PrimeQ@ #, CoprimeQ[#, n]] &], {n, 23}] // Flatten
  • Python
    from sympy import gcd, isprime
    def a(n): return list(filter(lambda k: isprime(k)==0 and gcd(k, n)==1, range(1, n + 1)))
    for n in range(1, 21): print(a(n)) # Indranil Ghosh, Apr 26 2017
Showing 1-4 of 4 results.