Fix Integer.factors()
commit98997b9a5378f4e3578674b5780e51a2a6a1871a
authorKirill Smelkov <kirr@landau.phys.spbu.ru>
Sun, 10 Aug 2008 13:18:45 +0000 (10 17:18 +0400)
committerKirill Smelkov <kirr@landau.phys.spbu.ru>
Sun, 10 Aug 2008 13:18:45 +0000 (10 17:18 +0400)
tree508c0e80a074119bea5d3d14ab7ea7aac7aa36cf
parent4fa9eb3e28a4b87be7c92b35cf7f77260c48329a
Fix Integer.factors()

I've spot this recently:

    In [1]: Integer(10).factors()
    Out[1]: {10: 1}

but it should be

    {2: 1, 5: 1}

Anyway, factors should be supported for Rationals too, but

    In [2]: Rational(10,3).factors()
    Out[2]: {3: -1, 10: 1}

which should be

    {2: 1, 3: -1, 5: 1}

It seems there was some leftover code in Rational.factors() (from revision 0),
so I've just deleted it and wrote tests.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Ondrej Certik <ondrej@certik.cz>
sympy/core/numbers.py
sympy/core/tests/test_numbers.py