login
Table of solutions to all possible Chinese Remainder Equations x = a1 mod p1, x = a2 mod p2, ..., x = an mod pn, where p1 - pn are the first n primes and each a1 - an varies between 1 and (its respective) p-1, with the rightmost a (an) varying fastest.
1

%I #9 Mar 06 2016 10:53:57

%S 1,1,5,1,7,13,19,11,17,23,29,1,121,31,151,61,181,127,37,157,67,187,97,

%T 43,163,73,193,103,13,169,79,199,109,19,139,71,191,101,11,131,41,197,

%U 107,17,137,47,167,113,23,143,53,173,83,29,149,59,179,89,209,1,211,421

%N Table of solutions to all possible Chinese Remainder Equations x = a1 mod p1, x = a2 mod p2, ..., x = an mod pn, where p1 - pn are the first n primes and each a1 - an varies between 1 and (its respective) p-1, with the rightmost a (an) varying fastest.

%F a(n) = prim_chrem_right(n) (see Maple code)

%e 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;

%p 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;

%p 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.

%t 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 *)

%Y Cf. A051853.

%K nonn,tabf

%O 1,3

%A _Antti Karttunen_, Dec 13 1999