Next prime date

Dates in Ireland are usually written as DD MMM YYYY i.e. 5 Sep 2016 or 12 Jan 2000 and so on.

However, from database perspective (which is my personal favourite) I like storing date values as integers of YYYYMMDD i.e. 20160905 or 20000112 etc.

Of course many of you are going to disagree on the above approach and – depending on viewpoint – you will be either right or wrong but this doesn’t change a thing. I like storing dates as YYYYMMDD integers regardless of your agreement or lack of thereof. Besides, as already mentioned many, many times before, this is my blog and if I decide to store dates as multiplies of an average age of a kangaroo in quarters divided by seventeen, it is entirely up to me 😉

So let’s get over it and see what we can do with such date representation.

We can surely check for primality of it!

Is today’s date a prime number?

It’s surely not. It ends with 5.

So when is the next prime date then?

It’s in 18 days from now: 23rd of September (20160923)

How many prime dates are remaining this year?

Just seven: 20160923, 20161007, 20161013, 20161019, 20161021, 20161027, 20161103.

It is worth mentioning that there’s gonna be a twin-prime pair of dates mid next month: 19th and 21st of October. These do not happen too often. The next such occurrence will take place in March next year and then in September next year. Twice a year is rare enough to have a pint!


Dodaj komentarz

Bądź pierwszy!

Powiadom o