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!)
A163463 a(1)=1. For n >= 2: If a(n-1) is coprime to n, then a(n) = the smallest integer > a(n-1) that is coprime to n. If a(n-1) is not coprime to n, then a(n) = the smallest integer > a(n-1) that is not coprime to n. 1

%I #15 Jul 26 2017 09:32:50

%S 1,3,6,8,9,10,11,13,14,15,16,18,19,23,26,28,29,31,32,34,37,39,40,42,

%T 43,45,48,49,50,51,52,54,55,57,58,60,61,63,65,66,67,71,72,74,76,78,79,

%U 83,85,86,88,90,91,95,99,101,103,105,106,108,109,111,112,114,116,117,118

%N a(1)=1. For n >= 2: If a(n-1) is coprime to n, then a(n) = the smallest integer > a(n-1) that is coprime to n. If a(n-1) is not coprime to n, then a(n) = the smallest integer > a(n-1) that is not coprime to n.

%H G. C. Greubel, <a href="/A163463/b163463.txt">Table of n, a(n) for n = 1..1000</a>

%t a = {1}; Do[If[GCD[n, a[[ -1]]] == 1, k = a[[ -1]] + 1; While[GCD[k, n] > 1, k++ ]; AppendTo[a, k], k = a[[ -1]] + 1; While[GCD[k, n] < 2, k++ ]; AppendTo[a, k]], {n, 2, 100}]; a (* _Stefan Steinerberger_, Aug 05 2009 *)

%o (PARI) al(n)=local(v,q);v=vector(n);v[1]=1;for(k=2,n,q=gcd(k,v[k-1])!=1;v[k]=v[k-1]+1;while(gcd(k,v[k])!=1!=q,v[k]++));v \\ _Franklin T. Adams-Watters_, Aug 06 2009

%K nonn

%O 1,2

%A _Leroy Quet_, Jul 28 2009

%E More terms from _Stefan Steinerberger_ and _Franklin T. Adams-Watters_, Aug 05 2009

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 July 17 14:18 EDT 2024. Contains 374377 sequences. (Running on oeis4.)