[go: up one dir, main page]

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!)
A355212 A variant of the EKG sequence (A064413) where the least value not yet in the sequence appears as soon as possible. 2
1, 2, 6, 3, 12, 4, 10, 5, 35, 7, 14, 8, 18, 9, 33, 11, 143, 13, 39, 15, 20, 16, 34, 17, 323, 19, 57, 21, 24, 22, 46, 23, 115, 25, 30, 26, 36, 27, 42, 28, 58, 29, 899, 31, 62, 32, 74, 37, 148, 38, 40, 82, 41, 1763, 43, 86, 44, 48, 45, 141, 47, 329, 49, 56, 50 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
To build the sequence:
- we start with a(1) = 1 and a(2) = 2, and then repeatedly:
- let a(n) be the last known term and v the least value not yet in the sequence,
- if gcd(a(n), v) > 1
then a(n+1) = v,
- otherwise:
- let w be the least value not yet in the sequence such that gcd(a(n), w) > 1
and gcd(w, v) > 1,
- then a(n+1) = w and a(n+2) = v.
This sequence is a permutation of the positive integers with inverse A355213.
The construction is similar to that of A352713.
LINKS
Rémy Sigrist, PARI program
EXAMPLE
The first terms are (stars correspond to "w" terms):
n a(n) w
-- ---- -
1 1
2 2
3 6 *
4 3
5 12 *
6 4
7 10 *
8 5
9 35 *
10 7
11 14 *
12 8
13 18 *
14 9
15 33 *
16 11
PROG
(PARI) See Links section.
(Python)
from math import gcd
from itertools import count, islice
def agen(): # generator of terms
aset, an, v = {1, 2}, 2, 3; yield from [1, 2]
for n in count(3):
if gcd(an, v) == 1:
w = v + 1
while w in aset or gcd(an, w) == 1 or gcd(w, v) == 1: w += 1
aset.add(w); yield w
an = v; aset.add(an); yield an
while v in aset: v += 1
print(list(islice(agen(), 65))) # Michael S. Branicky, Jun 24 2022
CROSSREFS
Cf. A064413, A352713, A355213 (inverse).
Sequence in context: A353916 A370501 A253279 * A297076 A304752 A113552
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Jun 24 2022
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 September 1 06:23 EDT 2024. Contains 375575 sequences. (Running on oeis4.)