A085084 Smallest number not yet used which is not a prime but is relatively prime to the previous term.
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
Offset: 1
Links
- T. D. Noe, Table of n, a(n) for n=1..1000
Crossrefs
Programs
-
Haskell
import Data.List (find, delete) import Data.Maybe (fromJust) a085084 n = a085084_list !! (n-1) 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
-
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[n-1], k], AppendTo[A085084, k]; Throw[k]]]]; Table[ a[n], {n, 1, 68}] (* Jean-François Alcover, Jul 17 2012 *)
Extensions
Corrected and extended by Vladeta Jovovic, Jul 05 2003
Additional comments from Franklin T. Adams-Watters, Sep 19 2006
Edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar
Comments