login
A345709
A variation on the Yellowstone permutation: a(n) = n if n <= 3, a(4) = 5; otherwise the smallest number not occurring earlier having at least one common factor with a(n-2), but none with a(n-1), with the condition that two odd terms alternate with one even term.
1
1, 2, 3, 5, 6, 25, 9, 10, 21, 55, 12, 11, 15, 22, 27, 77, 18, 7, 33, 14, 39, 35, 24, 49, 45, 28, 51, 91, 30, 13, 57, 26, 19, 65, 38, 75, 133, 20, 63, 85, 36, 17, 69, 34, 23, 119, 46, 105, 253, 40, 99, 95, 42, 115, 81, 50, 87, 125, 48, 145, 93, 58, 31, 29, 62, 203, 155, 56, 135, 161, 54
OFFSET
1,2
COMMENTS
Unlike the Yellowstone permutation (A098550) and the alternating parity Yellowstone permutation (A344176), the primes do not appear in their natural order. Indeed, after the initial conditions 2, 3 and 5, the next primes to appear are 11, 7, 13, 19, 17, 23, 31, 29.
Not a permutation of the positive integers since no larger powers of 2 appear as terms of the sequence.
LINKS
Sean A. Irvine, Java program (github)
MATHEMATICA
Array[(a@#=#)&, 3]; a[4]=5; a[n_]:=a[n]=(If[And@@OddQ[{a[n-1], a[n-2]}], k=2, k=1]; While[MemberQ[Array[a, n-1], k]||GCD[a[n-2], k]<2||GCD[a[n-1], k]>1, k=k+2]; k); Array[a, 100] (* Giorgos Kalogeropoulos, Jul 23 2021 *)
CROSSREFS
Sequence in context: A238335 A131599 A263650 * A076384 A261579 A376655
KEYWORD
nonn
AUTHOR
Enrique Navarrete, Jun 24 2021
STATUS
approved