

A085084


Smallest number not yet used which is not a prime but is relatively prime to the previous term.


4



1, 4, 9, 8, 15, 14, 25, 6, 35, 12, 49, 10, 21, 16, 27, 20, 33, 26, 45, 22, 39, 28, 51, 32, 55, 18, 65, 24, 77, 30, 91, 34, 57, 40, 63, 38, 69, 44, 75, 46, 81, 50, 87, 52, 85, 36, 95, 42, 115, 48, 119, 54, 121, 56, 93, 58, 99, 62, 105, 64, 111, 68, 117, 70, 123, 74, 125, 66
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

Every composite number appears in this sequence. Eventually, every p^2 (p prime) will appear; if the smallest unused composite does not follow, it will appear no later than following the next p^2.


LINKS

T. D. Noe, Table of n, a(n) for n=1..1000


MAPLE

# Corrected Maple program from Chen Zekai, Mar 23 2015, added by N. J. A. Sloane, Mar 23 2015
A085084 := proc (q) local a, b, i, n; if q = 1 then print(1); return; elif q = 2 then print(1); print(4); return; fi; a := {1, 4}; b := 4; i := 2; print(1); print(4); while i < q do for n from 6 to q^2 doif not isprime(n) and gcd(b, n) = 1 and {} = a intersect {n} thenb := n; a := a union {n}; i := i+1; print(n); break; fi; od; od; end:A085084(10000):


MATHEMATICA

A085084 = {a[1]=1, a[2]=4}; a[n_] := a[n] = Catch[For[k = 6, True, k++, If[!PrimeQ[k] && !MemberQ[A085084, k] && CoprimeQ[a[n1], k], AppendTo[A085084, k]; Throw[k]]]]; Table[ a[n], {n, 1, 68}] (* JeanFrançois Alcover, Jul 17 2012 *)


PROG

(Haskell)
import Data.List (find, delete)
import Data.Maybe (fromJust)
a085084 n = a085084_list !! (n1)
a085084_list = 1 : f 1 a002808_list where
f x cs = y : f y (delete y cs) where
y = fromJust $ find ((== 1) . (gcd x)) cs
 Reinhard Zumkeller, Dec 01 2012


CROSSREFS

Sequences with related definitions: A051884, A064413, A075570, A163642, A240024.
Cf. A000027.
Sequence in context: A140808 A163642 A220533 * A248390 A075570 A236630
Adjacent sequences: A085081 A085082 A085083 * A085085 A085086 A085087


KEYWORD

easy,nice,nonn


AUTHOR

Amarnath Murthy, Jul 02 2003


EXTENSIONS

Corrected and extended by Vladeta Jovovic, Jul 05 2003
Additional comments from Franklin T. AdamsWatters, Sep 19 2006
Edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar


STATUS

approved



