|
|
A251555
|
|
a(1)=1, a(2)=3, a(3)=2; thereafter a(n) is the smallest number not occurring earlier having at least one common factor with a(n-2), but none with a(n-1).
|
|
5
|
|
|
1, 3, 2, 9, 4, 15, 8, 5, 6, 25, 12, 35, 16, 7, 10, 21, 20, 27, 14, 33, 26, 11, 13, 22, 39, 28, 45, 32, 51, 38, 17, 18, 85, 24, 55, 34, 65, 36, 91, 30, 49, 40, 63, 44, 57, 46, 19, 23, 76, 69, 50, 81, 52, 75, 56, 87, 62, 29, 31, 58, 93, 64, 99, 68, 77, 48, 119, 54, 133, 60, 161, 66, 115, 42, 95, 72, 125
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
A variant of A098550. See that entry for much more information.
It seems likely that this sequence will never merge with A098550, but it would be nice to have a proof.
|
|
LINKS
|
|
|
MATHEMATICA
|
a[1]=1; a[2]=3; a[3]=2;
a[n_] := a[n] = For[k=2, True, k++, If[FreeQ[A251555, k], If[!CoprimeQ[k, a[n-2]] && CoprimeQ[k, a[n-1]], AppendTo[A251555, k]; Return[k]]]];
|
|
PROG
|
(Python)
from fractions import gcd
A251555_list, l1, l2, s, b = [1, 3, 2], 2, 3, 4, set()
for _ in range(10**4):
....i = s
....while True:
........if not i in b and gcd(i, l1) == 1 and gcd(i, l2) > 1:
............l2, l1 = l1, i
............b.add(i)
............while s in b:
................b.remove(s)
................s += 1
............break
(Haskell)
import Data.List (delete)
a251555 n = a251555_list !! (n-1)
a251555_list = 1 : 3 : 2 : f 3 2 [4..] where
f u v ws = g ws where
g (x:xs) = if gcd x u > 1 && gcd x v == 1
then x : f v x (delete x ws) else g xs
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|