| 
									
										
										
										
											2007-12-26 16:42:33 -05:00
										 |  |  | ! Copyright (c) 2007 Samuel Tardieu | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2007-12-28 07:44:00 -05:00
										 |  |  | USING: kernel math math.functions sequences ;
 | 
					
						
							| 
									
										
										
										
											2007-12-26 16:42:33 -05:00
										 |  |  | IN: math.algebra | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : chinese-remainder ( aseq nseq -- x )
 | 
					
						
							|  |  |  |   dup product
 | 
					
						
							| 
									
										
										
										
											2007-12-28 07:44:00 -05:00
										 |  |  |   [ [ over / [ swap gcd drop ] keep * * ] curry 2map sum ] keep rem ; foldable
 |