Coding Question from Deloitte Assesment

Recently i appeared for Deloitte Assesment and this coding question felt nearly impossible please if someone could guide an approach
You are given with two integers N and D find all the N digit Prime Numbers having D as their most frequent digit. E.g. if N=2 and D=3 so we have to find 2 digit integers having 3 as the most frequent digit so answer will be [13,23,31,37,43,53,73,83] as these contain 3 as the most frequent digit

Constraint for D is 1<=D<=9
Constraint for N is 0<=N<= 10^18

10^18 digits how would you do that i have this doubt

Comments (4)