login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A085084 Smallest number not yet used which is not a prime but is relatively prime to the previous term. 4

%I #26 Jul 20 2017 10:55:05

%S 1,4,9,8,15,14,25,6,35,12,49,10,21,16,27,20,33,26,45,22,39,28,51,32,

%T 55,18,65,24,77,30,91,34,57,40,63,38,69,44,75,46,81,50,87,52,85,36,95,

%U 42,115,48,119,54,121,56,93,58,99,62,105,64,111,68,117,70,123,74,125,66

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

%C 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.

%H T. D. Noe, <a href="/A085084/b085084.txt">Table of n, a(n) for n=1..1000</a>

%p # Corrected Maple program from Chen Zekai, Mar 23 2015, added by _N. J. A. Sloane_, Mar 23 2015

%p 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):

%t 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 *)

%o (Haskell)

%o import Data.List (find, delete)

%o import Data.Maybe (fromJust)

%o a085084 n = a085084_list !! (n-1)

%o a085084_list = 1 : f 1 a002808_list where

%o f x cs = y : f y (delete y cs) where

%o y = fromJust $ find ((== 1) . (gcd x)) cs

%o -- _Reinhard Zumkeller_, Dec 01 2012

%Y Sequences with related definitions: A051884, A064413, A075570, A163642, A240024.

%Y Cf. A000027.

%K easy,nice,nonn

%O 1,2

%A _Amarnath Murthy_, Jul 02 2003

%E Corrected and extended by _Vladeta Jovovic_, Jul 05 2003

%E Additional comments from _Franklin T. Adams-Watters_, Sep 19 2006

%E Edited by _N. J. A. Sloane_, Jul 03 2008 at the suggestion of _R. J. Mathar_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 15:34 EDT 2024. Contains 371794 sequences. (Running on oeis4.)