Those who believe in miracles are as great as miracles themselves. -- From an unknown book
There are many dates when there are miracles. Suppose the date is expressed as an 8-digit number, 1st~4th represents the year, 5th~6th represents the month, 7th~8th represents the day, when the corresponding digit isn't enough, use 0 to pad right, and such date exists in real world. For instance, 20191002 is a valid date , while 20190229 is not. The year ranges from 0001 to 9999.
After observation, the dates when miracles take place have these properties (ignore the zeros before the digits):
The number composed by digits represing the day is a prime number . For instance, for 20191002, 02 is a prime number.
The number composed by digits represing the month and day is a prime number . For instance, for 20191002, 1002 is not a prime number.
The whole date is a prime number . For instance, for 20191002, 20191002 is not a prime number.
Now, you need to figure out how many valid dates are there in total when miracles take place.
Note: Be careful to check whether it is a leap year or not. Year 3200, 6400, 9600 are considered as leap years.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The following Python code outputs an answer of 5 5 1 5 7 .