cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A085084 #26 Jul 20 2017 10:55:05
%S A085084 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 A085084 55,18,65,24,77,30,91,34,57,40,63,38,69,44,75,46,81,50,87,52,85,36,95,
%U A085084 42,115,48,119,54,121,56,93,58,99,62,105,64,111,68,117,70,123,74,125,66
%N A085084 Smallest number not yet used which is not a prime but is relatively prime to the previous term.
%C A085084 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 A085084 T. D. Noe, <a href="/A085084/b085084.txt">Table of n, a(n) for n=1..1000</a>
%p A085084 # Corrected Maple program from Chen Zekai, Mar 23 2015, added by _N. J. A. Sloane_, Mar 23 2015
%p A085084 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 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 A085084 (Haskell)
%o A085084 import Data.List (find, delete)
%o A085084 import Data.Maybe (fromJust)
%o A085084 a085084 n = a085084_list !! (n-1)
%o A085084 a085084_list = 1 : f 1 a002808_list where
%o A085084    f x cs = y : f y (delete y cs) where
%o A085084             y = fromJust $ find ((== 1) . (gcd x)) cs
%o A085084 -- _Reinhard Zumkeller_, Dec 01 2012
%Y A085084 Sequences with related definitions: A051884, A064413, A075570, A163642, A240024.
%Y A085084 Cf. A000027.
%K A085084 easy,nice,nonn
%O A085084 1,2
%A A085084 _Amarnath Murthy_, Jul 02 2003
%E A085084 Corrected and extended by _Vladeta Jovovic_, Jul 05 2003
%E A085084 Additional comments from _Franklin T. Adams-Watters_, Sep 19 2006
%E A085084 Edited by _N. J. A. Sloane_, Jul 03 2008 at the suggestion of _R. J. Mathar_