Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

In a specified range, I want to get the number of numbers, in which sum of its digits and sum of squares of its digits are prime number. For an example from 2 to 12, there are only 2 numbers which has both its sum of digit and sum of square of its digit are prime number. These two numbers are 11 and 12. In 12, sum of its digit 1+2=3 and sum of square of its digit 1+4=5 are prime numbers.
Although the question is related to programming but it seems that there must be some number theory trick which can solve it quickly. I am very keen to know that trick if at all exists. Thank you.

share|improve this question
3  
For your grammatical edification: "it's" is NOT possessive; "it's" is short for "it is", which is a complete sentence. "Its" is possessive, and should be used in every place you used "it's" here. (I could just edit, but "teach a man to fish...") –  The Chaz 2.0 Apr 15 '12 at 18:18
    
@TheChaz: Thank you for the information. i have corrected it. If anywhere you find any grammatical mistakes, please let me know. :) –  Ravi Joshi Apr 15 '12 at 18:41
    
The other two most common homophone mistakes are you're/your and they're/their/there. –  The Chaz 2.0 Apr 15 '12 at 20:35
2  
Discussed as a programming problem at codereview.stackexchange.com/questions/8319/… –  Gerry Myerson Apr 16 '12 at 0:25
add comment

1 Answer

Analytic number theory could produce a heuristic for approximately how many numbers up to $x$ satisfy your two conditions (that is, a predicted asymptotic formula), but I doubt it can be proved. Even if it could, it would only give the answer approximately, not exactly as you seem to want. So I don't think there's any trick besides a brute-force calculation.

share|improve this answer
    
Okay... thanks a ton. –  Ravi Joshi Apr 15 '12 at 18:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.