fork download
  1. #!/bin/bash
  2. # your code goes here
  3.  
  4. function leyland() {
  5. # Presented here as a function body so multiple tests can be run within
  6. # Ideone. But the following line also works as a standalone program:
  7. printf %s\\n x={2..32}\;y={2..32}\;x^y+y^x|bc|sort -nu|sed $1!d
  8. }
  9.  
  10. for testcase in 1 2 3 4 5 10 20 30; do
  11. echo "leyland[$testcase] = $(leyland $testcase)"
  12. done
Success #stdin #stdout 0.07s 5260KB
stdin
Standard input is empty
stdout
leyland[1] = 8
leyland[2] = 17
leyland[3] = 32
leyland[4] = 54
leyland[5] = 57
leyland[10] = 368
leyland[20] = 6250
leyland[30] = 69632