OFFSET
1,2
COMMENTS
The number a(n) is even if and only if n is even. If n>=1, then a(2n) = a(2n-1) + 1. If n>=2, then a(2n+1) - a(2n) >= 5. As a consequence, if n>=15, then a(n) > 3n. - Benoit Jubin, Dec 07 2014
A098549(n) = a(a(n)).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
David L. Applegate, Hans Havermann, Bob Selcoe, Vladimir Shevelev, N. J. A. Sloane, and Reinhard Zumkeller, The Yellowstone Permutation, arXiv preprint arXiv:1501.01669 [math.NT], 2015 and J. Int. Seq. 18 (2015) 15.6.7.
Reinhard Zumkeller, Table of n, a(n) for n = 1..100000
MAPLE
x2 := 0: for n from 1 to 1000 do x := x2 + 1: while (n >= 4 and (gcd(x, x2) > 1 or gcd(x, x1) = 1)) do x := x + 1: end do; print (n, x); x1 := x2: x2 := x: end do: # David Applegate, Nov 26 2014
MATHEMATICA
a := {1, 2, 3}; For[n = 4, n <= 1000, n++, If[GCD[n, a[[-1]]] == 1 && GCD[n, a[[-2]]] > 1, AppendTo[a, n]]]; a (* L. Edson Jeffery, Dec 04 2014 *)
PROG
(Haskell)
a098548 n = a098548_list !! (n-1)
a098548_list = 1 : 2 : 3 : f 2 3 [4..] where
f u v (w:ws) = if gcd u w > 1 && gcd v w == 1
then w : f v w ws else f u v ws
-- Reinhard Zumkeller, Nov 21 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Sep 14 2004
STATUS
approved