1. 3
  1.  

  2. 1

    This reminds me of Project Euler #607.