debian/dc_factor
raw| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Example taken from http://www.cs.unh.edu/~charpov/Programming/DC/ |
| 4 | # and minimally modified to use dc -e '...' instead of echo '...' | dc |
| 5 | # |
| 6 | # Usage: |
| 7 | # Invoke as 'dc_factor $ARG' and $ARG will be factored |
| 8 | # Example: |
| 9 | # $ ./dc_factor 123456789 |
| 10 | # 3 |
| 11 | # 3 |
| 12 | # 3607 |
| 13 | # 3803 |
| 14 | # |
| 15 | # Dirk Eddelbuettel <[email protected]> 09 May 2003 |
| 16 | |
| 17 | dc -e "$1[p]s2[lip/dli%0=1dvsr]s12sid2%0=13sidvsr[dli%0=1lrli2+dsi!>.]ds.xd1<2" |