Puzzle Question (For the week of July 27)

"Initialize a counter to zero. Then examine the sequence of prime numbers starting with 11. If the least significant digit of the prime number is either "3" or "7" then add that digit to your counter. If the least significant digit of the prime number is either "1" or "9" then subtract that digit from your counter:

 Number     Operation     Counter

   -        (Init)          0
  11         Sub 1         -1
  13         Add 3          2
  17         Add 7          9
  19         Sub 9          0
            
Presto! The counter has returned to zero! If we continue:
 Number     Operation     Counter

  23         Add 3          3
  29         Sub 9         -6
  31         Sub 1         -7
  37         Add 7          0
            
Presto! The counter has returned to zero again!"


Regular puzzle question: "At which prime number will the counter next return to zero?"

APS puzzle question: "At which prime number would the counter first return to zero if you had started with 3 (instead of 11) as the first prime number in the sequence?"


Regular Answer: 151

APS Answer: 71209