From test, 1 Year ago, written in JavaScript.
Embed
  1. function findSequence(goal) {
  2.   function find(start, history) {
  3.     if (start == goal)
  4.       return history;
  5.     else if (start > goal)
  6.       return null;
  7.     else
  8.       return find(start + 5, "(" + history + " + 5)") ||
  9.              find(start * 3, "(" + history + " * 3)");
  10.   }
  11.   return find(1, "1");
  12. }