Probability that an odd number (given number of digits and ending number) is prime

Given a prime number of N digits and the end digit, is there a formula that predicts the probability that it is prime ? Also as N gets large, is the probability independent of the end digit ?
(Potential nitpick avoidance : odd numbers ending with 5 are ignored for obvious reasons)

Here’s what I see with Excel

A> Given a 2 digit number, the probability of it being prime when the ending digit is:
a> 1 = 0.56 or 5/9 (11, 31, 41, 61, 71)
b> 3 = 0.67 or 6/9 (13, 23, 43, 53, 73, 83)
c> 7 = 0.56 or 5/9 (17, 37, 47, 67, 97)
d> 9 = 0.56 or 5/9 (19, 29, 59, 79, 89)

B> Given a 3 digit number, the probability of it being prime when the ending digit is:
a> 1 = 0.39 or 35/90
b> 3 = 0.39 or 35/90
c> 7 = 0.44 or 40/90
d> 9 = 0.37 or 33/90

B> Given a 4 digit number, the probability of it being prime when the ending digit is:
a> 1 = 0.30 or 266/900
b> 3 = 0.30 or 268/900
c> 7 = 0.29 or 262/900
d> 9 = 0.29 or 265/900

Proof that all odd numbers are prime.

There are a number of things known about this (or can be derived) due to the Prime number theorem.

This includes evens and multiples of 5, though.

Edit: I know this isn’t exactly what you want, but it’s a starting place for research on this topic. This also only really holds for large numbers.

???

Any large number ending in 0,2,4,5,6, or 8 cannot be prime. The probability of a number being prime is highly dependent on its last digit.

He was talking about if the only digits we’re considering are 1, 3, 7, or 9. Are they roughly evenly distributed among those four digits as N gets arbitrarily large?

Oh, whoops.

The number of primes less than x is asymptotically x/ln(x). This is like a cumulative distribution, so the density of primes near x is the derivative of this or 1/ln(x) - 1/[ln(x)][sup]2[/sup]. As we’re dealing with asymptotics, we can ignore the second term. So the density of primes near x is 1/ln(x) or the density of primes near 10[sup]k[/sup] is 1/[k ln(10)] =0.4343/k.

But that’s for all integers near 10[/sup]k[sup]. Only those ending in 1 3 7 9 can be prime and those comprise 40% of the integers so the density of primes amongst k digit integers ending in 1 3 7 or 9 is about 1.08/k.

Are primes equally distributed amongst integers ending in 1 3 7 and 9. I’d be amazed if they aren’t, but I don’t know a proof off hand.

Sorry I see I bollixed up the formatting and I doubt I’ll fix it within five minutes.

Numbers ending in 0, 2, 4, 5, 6, and 8 cannot be prime IN THE DECIMAL SYSTEM. But. If I may use a theological term, that is accident, not essence.

Numbers ending in 0 can’t be prime in any system based on an integer greater than 1 with the exception of 10 when the base is prime.

Your point being?

The point is that, in any base, there is at least one final digit which is significantly less likely to be prime.

One could go further and point out that, in any non-prime base (which is most of them), there are at least two such final digits.

How the various professions prove all odd numbers are prime:

Mathematician: “3 is prime, 5=3+2 is prime,7=5+2 is prime… therefore by induction all odd numbers are prime.”

Physicist: “3 is prime, 5 is prime, 7 is prime, 9 - experimental error, 11 is prime,… therefore all odd numbers are prime.”

Engineer: “3 is prime, 7 is prime, 9 is prime, 11 is prime… all odd numbers are prime.”

Attorney: “Nine may or may not be prime, depending on the witnesses’ testimonies and the physical evidence furnished.”
Attorney: “According to Smith v. Jones, 9 was judicially declared prime.”
Politician: “For a sufficient donation, 9 can be reclassified.”
Windows Programmer: “3 is prime. 5 is prime. 7 is prime. This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor.”
Statistician: “100% of the sample 5, 13, 37, 41 and 53 is prime, so it looks like it’s probably true that all odd numbers are prime.”
IT Support Representative: “We haven’t received any reports of non-prime odd numbers. Have you upgraded to the latest version of our product?”
Diversity Coordinator: “Why don’t we ask 9 what it wants to be?”
ISIS Member: “You have 72 hours to make 9 prime again. If not, we will behead your math teacher.”
Mormon: “9 is prime, the spirit tells me it’s true.”
Homeopath: “If you dilute it enough, 9’s primal nature comes out. Come see the light.”

Yes, by Dirichlet’s theorem. (I’m assuming you’re restricting to the case where that digit is 1, 3, 7, or 9. I’m also avoiding specifying formally exactly how those probabilities are defined.)

I should also point out that this statement isn’t obvious or even necessarily expected. By Dirichlet’s theorem, primes that are +1 mod 4 versus -1 mod 4 have the same asymptotic density. On the other hand, if you count the primes below some fixed N that are +1 mod 4 versus those that are -1 mod 4, the latter exceed the former “most of the time.” (I’m deliberately avoiding making the bit in quotes formal, but hopefully the general idea is clear from context.)