2 of 4
added 972 characters in body
DavidC
  • 25.3k
  • 2
  • 52
  • 105

#WolframLanguage (Mathematica) 187 bytes

There may be some reduction in size to be found. Explanation to follow...

t=ToString;p=PadLeft;d=DateObject;Cases[""<>{t/@p[#,If[Length@#<5,4, 5]],t/@ p[#2,2],t/@p[#3,2]}&@@@(IntegerDigits/@#[[1]]&/@DayRange[d@#,d@#2]),x_/;PalindromeQ@x&&PrimeQ@ToExpression@x]&

Test cases

t = ToString; p = PadLeft; d = DateObject;
Cases["" <> {t /@ p[#, If[Length@# < 5, 4, 5]], t /@ p[#2, 2], 
   t /@ p[#3, 2]} & @@@ (IntegerDigits /@ #[[1]] & /@ DayRange[d@#, d@#2]), x_ /; PalindromeQ@x && PrimeQ@ToExpression@x] &
[{10011, 10, 1}, {10017, 1, 1}]

(* {"100111001", "100131001", "100161001"} *)

Explanation of code

DayRange[d@#,d@#2] returns all of the dates between {10011, 10, 1}and {10017, 1, 1}. In this case, it returns approximately 5 years, 4 months of dates (precisely 1920 dates).

The dates are returned in Wolfram-standard formatting. For example, the first date will appear as DateObject[List[1,1,1],"Day","Gregorian",-5.]`

#[[1]] & /@ will remove the part of the date, in each date, that concerns us. In the example, DateObject[List[1,3,7],"Day","Gregorian",-5.] returns the abbreviated date, {1,3,7}.

t/@p[#3,2]} or ToString/@Padleft[#3,2] pads the third element, namely, the 7 standing "for 7th day of the month" as "07". Similar padding is provided for the single digit symbol for the month of March, namely, 3 is returned as "03".

p[#, If[Length@# < 5, 4, 5]] pads the year with zeros to reach the length of a 4 or 5 digit string. In this case, January, namely 1, is returned as `"00001"'.

"" <>... joins the strings. In this case, it returns "000010307".

Cases[...x_ /; PalindromeQ@x && PrimeQ@ToExpression@x] returns those cases, among the 1920 dates, that are palindromes and primes.

DavidC
  • 25.3k
  • 2
  • 52
  • 105