[go: up one dir, main page]

login
A360931
a(1) = 2, a(2) = 3; for n > 2, a(n) is the smallest number greater than 1 that has not appeared such that |a(n) - a(n-1)| has a common factor with a(n-2).
1
2, 3, 5, 8, 13, 7, 20, 6, 4, 10, 12, 14, 11, 9, 31, 16, 47, 15, 62, 17, 19, 36, 55, 21, 26, 23, 25, 48, 18, 22, 24, 28, 30, 32, 27, 29, 35, 64, 34, 38, 40, 42, 37, 33, 70, 43, 39, 82, 46, 44, 50, 52, 54, 41, 45, 86, 51, 49, 58, 65, 53, 63, 116, 56, 60, 66, 57, 59, 68, 127, 61, 188, 249, 67, 73, 140
OFFSET
1,1
COMMENTS
In the first 100000 terms the fixed points are 10, 16, 42, 52, 66; it is likely no more exist. The sequence is conjectured to be a permutation of the positive integers > 1.
LINKS
Scott R. Shannon, Image for n = 1..100000. The green line is a(n) = n.
EXAMPLE
a(6) = 7 as |7 - a(5)| = |7 - 13| = 6 which shares a common factor with a(4) = 8.
MATHEMATICA
nn = 120; c[_] = False; Array[Set[{a[#], c[# + 1]}, {# + 1, True}] &, 2]; i = 2; j = 3; u = 4; Do[k = u; While[Or[c[k], CoprimeQ[i, #]] &[Abs[k - j]], k++]; Set[{a[n], c[k], i, j}, {k, True, j, k}]; If[k == u, While[c[u], u++]], {n, 3, nn}], n]; Array[a, nn] (* Michael De Vlieger, Feb 26 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Feb 25 2023
STATUS
approved