Efficient way to check a prime of Prime digits

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I was trying to solve a question on number theory. It says, given a range (start, end $ le 10^15$ and end - start $ le 10^9$), how many prime digit prime numbers exist? Generating prime digits numbers is easy but to check whether this number is prime, it runs out of time. I discarded numbers ending with $2$ or $5$, still a large number to go through primality test. So is there an efficient way to do primality test for prime digits prime number.



Note: I tried with sieve but failed for large number typically $ge10^7$.










share|cite|improve this question



















  • 1




    I assume that a "prime digit" number means a number that, in base $10$, is written using only $2,3,5,7$? If so, I really can't imagine that there is a primality test that works especially well on this category.
    – lulu
    Sep 3 at 11:30











  • In that case how can we efficiently compute the solution of above stated problem?
    – Debasis Jana
    Sep 3 at 11:35






  • 2




    Those numbers are all quite small. $15$ digits is well within the range of rapid computation by standard methods. That is to say, this is a programming problem, not a math problem.
    – lulu
    Sep 3 at 11:38











  • Or does it mean a prime with a prime number of decimal digits? That's how I understood it before reading lulu's comment.
    – saulspatz
    Sep 3 at 12:46






  • 1




    I think I need to test with Millar Rabin approach.
    – Debasis Jana
    Sep 3 at 14:45














up vote
1
down vote

favorite












I was trying to solve a question on number theory. It says, given a range (start, end $ le 10^15$ and end - start $ le 10^9$), how many prime digit prime numbers exist? Generating prime digits numbers is easy but to check whether this number is prime, it runs out of time. I discarded numbers ending with $2$ or $5$, still a large number to go through primality test. So is there an efficient way to do primality test for prime digits prime number.



Note: I tried with sieve but failed for large number typically $ge10^7$.










share|cite|improve this question



















  • 1




    I assume that a "prime digit" number means a number that, in base $10$, is written using only $2,3,5,7$? If so, I really can't imagine that there is a primality test that works especially well on this category.
    – lulu
    Sep 3 at 11:30











  • In that case how can we efficiently compute the solution of above stated problem?
    – Debasis Jana
    Sep 3 at 11:35






  • 2




    Those numbers are all quite small. $15$ digits is well within the range of rapid computation by standard methods. That is to say, this is a programming problem, not a math problem.
    – lulu
    Sep 3 at 11:38











  • Or does it mean a prime with a prime number of decimal digits? That's how I understood it before reading lulu's comment.
    – saulspatz
    Sep 3 at 12:46






  • 1




    I think I need to test with Millar Rabin approach.
    – Debasis Jana
    Sep 3 at 14:45












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I was trying to solve a question on number theory. It says, given a range (start, end $ le 10^15$ and end - start $ le 10^9$), how many prime digit prime numbers exist? Generating prime digits numbers is easy but to check whether this number is prime, it runs out of time. I discarded numbers ending with $2$ or $5$, still a large number to go through primality test. So is there an efficient way to do primality test for prime digits prime number.



Note: I tried with sieve but failed for large number typically $ge10^7$.










share|cite|improve this question















I was trying to solve a question on number theory. It says, given a range (start, end $ le 10^15$ and end - start $ le 10^9$), how many prime digit prime numbers exist? Generating prime digits numbers is easy but to check whether this number is prime, it runs out of time. I discarded numbers ending with $2$ or $5$, still a large number to go through primality test. So is there an efficient way to do primality test for prime digits prime number.



Note: I tried with sieve but failed for large number typically $ge10^7$.







number-theory prime-numbers computational-mathematics






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Sep 3 at 12:07









Bernard

112k635104




112k635104










asked Sep 3 at 11:26









Debasis Jana

113




113







  • 1




    I assume that a "prime digit" number means a number that, in base $10$, is written using only $2,3,5,7$? If so, I really can't imagine that there is a primality test that works especially well on this category.
    – lulu
    Sep 3 at 11:30











  • In that case how can we efficiently compute the solution of above stated problem?
    – Debasis Jana
    Sep 3 at 11:35






  • 2




    Those numbers are all quite small. $15$ digits is well within the range of rapid computation by standard methods. That is to say, this is a programming problem, not a math problem.
    – lulu
    Sep 3 at 11:38











  • Or does it mean a prime with a prime number of decimal digits? That's how I understood it before reading lulu's comment.
    – saulspatz
    Sep 3 at 12:46






  • 1




    I think I need to test with Millar Rabin approach.
    – Debasis Jana
    Sep 3 at 14:45












  • 1




    I assume that a "prime digit" number means a number that, in base $10$, is written using only $2,3,5,7$? If so, I really can't imagine that there is a primality test that works especially well on this category.
    – lulu
    Sep 3 at 11:30











  • In that case how can we efficiently compute the solution of above stated problem?
    – Debasis Jana
    Sep 3 at 11:35






  • 2




    Those numbers are all quite small. $15$ digits is well within the range of rapid computation by standard methods. That is to say, this is a programming problem, not a math problem.
    – lulu
    Sep 3 at 11:38











  • Or does it mean a prime with a prime number of decimal digits? That's how I understood it before reading lulu's comment.
    – saulspatz
    Sep 3 at 12:46






  • 1




    I think I need to test with Millar Rabin approach.
    – Debasis Jana
    Sep 3 at 14:45







1




1




I assume that a "prime digit" number means a number that, in base $10$, is written using only $2,3,5,7$? If so, I really can't imagine that there is a primality test that works especially well on this category.
– lulu
Sep 3 at 11:30





I assume that a "prime digit" number means a number that, in base $10$, is written using only $2,3,5,7$? If so, I really can't imagine that there is a primality test that works especially well on this category.
– lulu
Sep 3 at 11:30













In that case how can we efficiently compute the solution of above stated problem?
– Debasis Jana
Sep 3 at 11:35




In that case how can we efficiently compute the solution of above stated problem?
– Debasis Jana
Sep 3 at 11:35




2




2




Those numbers are all quite small. $15$ digits is well within the range of rapid computation by standard methods. That is to say, this is a programming problem, not a math problem.
– lulu
Sep 3 at 11:38





Those numbers are all quite small. $15$ digits is well within the range of rapid computation by standard methods. That is to say, this is a programming problem, not a math problem.
– lulu
Sep 3 at 11:38













Or does it mean a prime with a prime number of decimal digits? That's how I understood it before reading lulu's comment.
– saulspatz
Sep 3 at 12:46




Or does it mean a prime with a prime number of decimal digits? That's how I understood it before reading lulu's comment.
– saulspatz
Sep 3 at 12:46




1




1




I think I need to test with Millar Rabin approach.
– Debasis Jana
Sep 3 at 14:45




I think I need to test with Millar Rabin approach.
– Debasis Jana
Sep 3 at 14:45















active

oldest

votes











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2903774%2fefficient-way-to-check-a-prime-of-prime-digits%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2903774%2fefficient-way-to-check-a-prime-of-prime-digits%23new-answer', 'question_page');

);

Post as a guest













































































這個網誌中的熱門文章

How to combine Bézier curves to a surface?

Mutual Information Always Non-negative

Why am i infinitely getting the same tweet with the Twitter Search API?