factor/extra/math/algebra/algebra.factor

11 lines
304 B
Factor
Raw Normal View History

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