|
|
A053669
|
|
Smallest prime not dividing n.
|
|
137
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
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.
|
|
LINKS
|
|
|
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) << 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
|
|
EXAMPLE
|
a(60) = 7, since all primes smaller than 7 divide 60 but 7 does not.
|
|
MAPLE
|
f:= proc(n) local p;
p:= 2;
while n mod p = 0 do p:= nextprime(p) od:
p
end proc:
|
|
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 *)
|
|
PROG
|
(Haskell)
a053669 n = head $ dropWhile ((== 0) . (mod n)) a000040_list
(Python)
from sympy import nextprime
def a(n):
p = 2
while True:
if n%p: return p
(Python)
# using standard library functions only
import math
def a(n):
k = 2
while math.gcd(n, k) > 1: k += 1
|
|
CROSSREFS
|
Cf. A000040, A020639, A053670, A053671, A053672, A053673, A053674, A055874, A079578, A087560, A096014, A235921, A236454, A249270, A257993 (the indices of these primes), A276086, A324895.
|
|
KEYWORD
|
nonn,nice,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
More terms from Andrew Gacek (andrew(AT)dgi.net), Feb 21 2000 and James A. Sellers, Feb 22 2000
|
|
STATUS
|
approved
|
|
|
|