A 11-digit number is such that it contains each of the digits from 1 to 9
at least once.
What is the percentage of prime numbers in such an occurrence?
There are 90 billion 11-digit numbers between 10^10 and 10^11.
The pi function, π(x) = x/ln(x), estimates the number of primes below a given value.
π(10^11) - π(10^10) is about 3.5 billion expected 11-digit primes.
For a random 11 digit number we expect a 3.5/90 = 7/180
=~ .03889 probability of it being prime.
But our 11-digit numbers are constrained.
Of the comb(10,2) = 55 possible ways to add 2 more digits to 123456789, only 36 do not result in a list of digits whose sod() is not divisible by 3.
In other words: 19/55 = .34545 are divisible by 3
Also statistically, 5 of our 11 digits are even and 6 odd, so only .4545 of them are divisible by 2.
So whereas a random integer has a 1/3 chance of being relatively prime to both 2 and 3, for our numbers it is about 0.357
So I have an estimate of (7/180) * (0.357) / (1/3) = 0.04165
I also wrote a program, which I think would work except it might have to run for days. I excluded 19 of the 55 2 digit concatenations, and I forced the numbers to end in 1,3,7,9. After letting it run a few minutes I found a ratio of: 0.15288860231559565 ...
... but that has to be multiplied by (36/55) and (4/10) to take into account the excluded numbers.
0.15288860231559565 * (36/55) * (4/10) = 0.04002901587899232
So I have one estimate of 4.17%
and another estimate of 4.00%
A randomized program might be better.
---- code; not run to completion ----
from itertools import permutations
extra2s = []
for nn in range(10,100):
if nn%3 == 0:
continue
strnn = ''.join(sorted(str(nn)))
if strnn not in extra2s:
extra2s.append(strnn)
list1 = ['23456789' + extra for extra in extra2s]
list3 = ['12456789' + extra for extra in extra2s]
list7 = ['12345689' + extra for extra in extra2s]
list9 = ['12345678' + extra for extra in extra2s]
digitdict = {'1': list1, '3':list3, '7': list7, '9': list9}
total = 0
prime_count = 0
for last in '1379':
for digits in digitdict[last]:
for p in permutations(digits):
if p[0] == '0':
continue
total += 1
num = int(''.join(p) + last)
if isprime(num):
prime_count += 1
ratio = prime_count / total
|
Posted by Larry
on 2024-07-12 16:34:29 |