The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A122280 a(1) = 1, a(2) = 2; for n >= 3, a(n) = the smallest positive integer not occurring earlier in the sequence such that gcd(a(n-1), a(n)) is a prime. 5
1, 2, 4, 6, 3, 9, 12, 10, 5, 15, 18, 8, 14, 7, 21, 24, 22, 11, 33, 27, 30, 16, 26, 13, 39, 36, 34, 17, 51, 42, 20, 25, 35, 28, 38, 19, 57, 45, 40, 46, 23, 69, 48, 50, 32, 54, 44, 55, 60, 58, 29, 87, 63, 49, 56, 62, 31, 93, 66, 52, 65, 70, 64, 74, 37, 111, 72, 75, 78, 68, 82, 41 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..5002 [Computed using Ray Chandler's Mma program]
MATHEMATICA
f[s_] := Block[{k = 1}, While[MemberQ[s, k] || ! PrimeQ[GCD[Last[s], k]], k++ ]; Append[s, k] ]; Nest[f, {1, 2}, 75] (* Ray Chandler, Aug 30 2006 *)
PROG
(Python)
from math import gcd
from sympy import isprime
from itertools import islice
def agen(): # generator of terms
aset, an, mink = {1, 2}, 2, 3
yield from sorted(aset)
while True:
k = mink
while k in aset or not isprime(gcd(an, k)): k += 1
an = k; aset.add(an); yield an
while mink in aset: mink += 1
print(list(islice(agen(), 72))) # Michael S. Branicky, Oct 13 2022
CROSSREFS
Sequence in context: A336946 A357777 A348086 * A365259 A356851 A291577
KEYWORD
nonn
AUTHOR
Leroy Quet, Aug 29 2006
EXTENSIONS
Extended by Ray Chandler and Klaus Brockhaus, Aug 30 2006
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 4 17:49 EDT 2024. Contains 373102 sequences. (Running on oeis4.)