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!)
A122090 a(1)=1. a(n) = smallest integer that is greater than a(n-1) and is coprime to the largest nonprime (1 or composite) occurring among the first (n-1) terms of the sequence. 1

%I #14 Oct 11 2019 14:07:37

%S 1,2,3,4,5,7,9,10,11,13,17,19,21,22,23,25,26,27,28,29,31,33,34,35,36,

%T 37,41,43,47,49,50,51,52,53,55,56,57,58,59,61,63,64,65,66,67,71,73,79,

%U 83,85,86,87,88,89,91,92,93,94,95,96,97,101,103,107,109,113,115,116,117

%N a(1)=1. a(n) = smallest integer that is greater than a(n-1) and is coprime to the largest nonprime (1 or composite) occurring among the first (n-1) terms of the sequence.

%e The smallest integer that is greater than a(20)=29 and is coprime to 28 (the largest nonprime which occurs among the first 20 terms of the sequence) is 31. So a(21) = 31.

%p A122090 := proc(maxn) local a,nexta,n,lanopr; a := [1]; lanopr := 1; for n from 2 to maxn do nexta := op(n-1,a)+1; while gcd(nexta,lanopr) >1 do nexta := nexta+1; od; a := [op(a), nexta]; if not isprime(nexta) and nexta > lanopr then lanopr := nexta; fi; od; RETURN(a); end: maxn := 100 : alist := A122090(maxn) : for i from 1 to maxn do printf("%d,",op(i,alist)); end : # _R. J. Mathar_, Oct 21 2006

%t f[l_List] := Block[{k = Last[l] + 1, m = Max[Select[l, ! PrimeQ[ # ] &]]},While[GCD[k, m] > 1, k++ ];Append[l, k]];Nest[f, {1}, 70] (* _Ray Chandler_, Oct 19 2006 *)

%K nonn

%O 1,2

%A _Leroy Quet_, Oct 17 2006

%E Extended by _Ray Chandler_, Oct 19 2006

%E More terms from _R. J. Mathar_, Oct 21 2006

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 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)