fork download
  1. #!/bin/bash
  2.  
  3. # Presented as a function to allow all tests to be run ...
  4. function f() {
  5. # ... but the following line may be a standalone program too:
  6. seq 2 $1|factor|sed -r 's/:?( \w+)\1*/-\1*\1/g'|bc|nl -v2|sort -nrk2|sed q
  7. }
  8.  
  9. for t in 3 10 50 1000 9999; do
  10. f $t
  11. done
Success #stdin #stdout 0.22s 6848KB
stdin
Standard input is empty
stdout
     2	-2
     8	4
    48	35
  1000	971
  9984	9802