[go: up one dir, main page]

login
Search: a163642 -id:a163642
     Sort: relevance | references | number | modified | created      Format: long | short | data
Smallest number not yet used which is not a prime but is relatively prime to the previous term.
+10
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
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.
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 *)
PROG
(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
CROSSREFS
Sequences with related definitions: A051884, A064413, A075570, A163642, A240024.
Cf. A000027.
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. Adams-Watters, Sep 19 2006
Edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar
STATUS
approved
a(0)=1. For n >= 1, a(n) is the smallest composite integer that is > a(n-1) and that is coprime to n.
+10
4
1, 4, 9, 10, 15, 16, 25, 26, 27, 28, 33, 34, 35, 36, 39, 44, 45, 46, 49, 50, 51, 52, 57, 58, 65, 66, 69, 70, 75, 76, 77, 78, 81, 82, 87, 88, 91, 92, 93, 94, 99, 100, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 133, 134, 135, 136, 141, 142, 143, 144, 145
OFFSET
0,2
LINKS
MAPLE
A163643 := proc(n) if n = 0 then 1; else for a from procname(n-1)+1 do if not isprime(a) then if gcd(a, n) = 1 then return a; end if; end if; end do: end if; end proc: seq(A163643(n), n=0..100) ; # R. J. Mathar, Oct 09 2010
MATHEMATICA
a = {4}; Do[k = a[[n]] + 1; While[Nand[CompositeQ@ k, ! MemberQ[a, k], CoprimeQ[k, n + 1]], k++]; AppendTo[a, k], {n, 61}]; {1}~Join~a (* Michael De Vlieger, Jul 23 2017 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Leroy Quet, Aug 02 2009
EXTENSIONS
More terms from R. J. Mathar, Oct 09 2010
STATUS
approved

Search completed in 0.008 seconds