If the first step, from the first to the second digit is a decrease, then it is a zigzag number. An example is 5372957391.
Similarly a zagzig number is when the first step from the first to the second digit is an increase, e.g.3729573.
Find the smallest number of digits, d, for which both conditions are true:
* a unique d-digit zeroless zigzag prime whose square is a zeroless zigzag
and also
*a unique d-digit zeroless zagzig prime whose square is a zeroless zigzag
And also find the two primes and their squares.
Note that d=2 almost works, except that the squares are zagzigs:
19^2 = 361
43^2 = 1849