OFFSET
1,3
FORMULA
a(n) = prim_chrem_right(n) (see Maple code)
EXAMPLE
Rows have lengths 1,2,8,48,480,5760,92160,... (A005867(n)) and terms 1; 1,5; 1,7,13,19,11,17,23,29;
MAPLE
with(numtheory); incr_plist_from_right := proc(aa) local i, n, a; a := aa; n := nops(a); for i from n by -1 to 1 do if(a[i] < (ithprime(i)-1)) then a[i] := a[i]+1; RETURN(a); else a[i] := 1; fi; od; RETURN([op(a), 1]); end;
incr_plist_from_right_n_times := proc(aa, n) local a, i; a := aa; for i from 1 to n do a := incr_plist_from_right(a); od; RETURN(a); end; prim_chrem_right := proc(n) local r, m; r := incr_plist_from_right_n_times([], n); m := form_modlist(r); RETURN(chrem(r, m)); end; # For form_modlist see A051853.
MATHEMATICA
row[n_] := Module[{i}, pp = Prime[Range[n]]; iter = Sequence @@ Table[{ i[k], 1, pp[[k]] - 1}, {k, 1, n}]; Table[ChineseRemainder[Array[i, n], pp], iter // Evaluate] // Flatten]; Table[row[n], {n, 1, 5}] // Flatten (* Jean-François Alcover, Mar 06 2016 *)
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Antti Karttunen, Dec 13 1999
STATUS
approved