login
Irregular array: row n contains A175307(n) terms. The first term of each row, a(n,1) = n. a(n,m) = the smallest integer > a(n,m-1) such that a(n,m), a(n,m)-1, and a(n,m)+1 are each coprime to all earlier terms in their row. The row terminates when a multiple of 2 or 3 is obtained.
2

%I #15 Jul 25 2020 10:38:54

%S 1,2,2,3,4,5,7,12,6,7,9,8,9,10,11,13,15,12,13,15,14,15,16,17,19,21,18,

%T 19,21,20,21,22,23,25,27,24,25,27,26,27,28,29,31,33,30,31,33,32,33,34,

%U 35,37,47,52,36,37,39,38,39,40,41,43,45,42,43,45,44,45,46,47,49,51,48,49,51,50,51,52,53

%N Irregular array: row n contains A175307(n) terms. The first term of each row, a(n,1) = n. a(n,m) = the smallest integer > a(n,m-1) such that a(n,m), a(n,m)-1, and a(n,m)+1 are each coprime to all earlier terms in their row. The row terminates when a multiple of 2 or 3 is obtained.

%H Robert Israel, <a href="/A175306/b175306.txt">Table of n, a(n) for n = 1..10102</a>

%p A175306:= proc(n)

%p local R,last,k,P;

%p R:= n;

%p last:= n;

%p P:= n;

%p while igcd(last,6)=1 do

%p for k from last+1 do

%p if igcd(k-1,P) = 1 and igcd(k,P) = 1 and igcd(k+1,P) =1 then

%p R:= R, k; last:= k; P:= P*k; break

%p fi

%p od

%p od;

%p R

%p end proc:

%p map(A175306, [$1..100]); # _Robert Israel_, Feb 10 2017

%t row[n_] := Module[{R = {n}, last = n, k, P = n}, While[GCD[last, 6] == 1, For[k = last + 1, True, k++, If[GCD[k - 1, P] == 1 && GCD[k, P] == 1 && GCD[k + 1, P] == 1, AppendTo[R, k]; last = k; P = P k; Break[]]]]; R];

%t Array[row, 100] // Flatten (* _Jean-François Alcover_, Jul 25 2020, after _Robert Israel_ *)

%Y Cf. A175307

%K nonn,tabf

%O 1,2

%A _Leroy Quet_, Mar 26 2010