1. 7
  1.  

  2. 4

    The J program, but in k:

    a: |/ 5 18 =\: {x#!*/x} 2 3 4
    2 3 4 \'&,// a