factor/extra/math/algebra/algebra.factor

10 lines
303 B
Factor
Raw Normal View History

2008-11-07 01:24:32 -05:00
! 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 )
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