| 
									
										
										
										
											2008-11-07 01:24:32 -05:00
										 |  |  | ! Copyright (c) 2007 Samuel Tardieu. | 
					
						
							| 
									
										
										
										
											2007-12-26 16:42:33 -05:00
										 |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2008-10-03 03:19:03 -04:00
										 |  |  | USING: kernel math math.functions sequences fry ;
 | 
					
						
							| 
									
										
										
										
											2007-12-26 16:42:33 -05:00
										 |  |  | IN: math.algebra | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : chinese-remainder ( aseq nseq -- x )
 | 
					
						
							| 
									
										
										
										
											2008-11-07 01:24:32 -05:00
										 |  |  |     dup product [ | 
					
						
							| 
									
										
										
										
											2008-10-03 03:19:03 -04:00
										 |  |  |         '[ _ over / [ swap gcd drop ] keep * * ] 2map sum
 | 
					
						
							|  |  |  |     ] keep rem ; foldable
 |