an interesting problem
|
05-02-2015, 08:37 PM
Post: #1
|
|||
|
|||
an interesting problem
Does there exist a 3-digit integer such that all 3-digit combinations of those 3 digits are prime numbers? What is the minimum number of numbers you would have to check to answer this question?
I'm not looking for a program for this, just some basic logic. |
|||
05-02-2015, 09:05 PM
(This post was last modified: 05-02-2015 09:05 PM by Gerald H.)
Post: #2
|
|||
|
|||
RE: an interesting problem
Are you sure you want the minimum number you must check? Don't you mean the maximum you must check?
|
|||
05-02-2015, 09:53 PM
Post: #3
|
|||
|
|||
RE: an interesting problem | |||
05-02-2015, 11:27 PM
Post: #4
|
|||
|
|||
RE: an interesting problem
It won't be an even number.
I just blew out 1/2 the possibilities, no one else can pare down the list as much as I just did. 2speed HP41CX,int2XMEM+ZEN, HPIL+DEVEL, HPIL+X/IO, I/R, 82143, 82163, 82162 -25,35,45,55,65,67,70,80 |
|||
05-02-2015, 11:44 PM
Post: #5
|
|||
|
|||
RE: an interesting problem | |||
05-03-2015, 12:01 AM
Post: #6
|
|||
|
|||
RE: an interesting problem
Via a karnaugh veitch diagram / map?
Best regards -Ray |
|||
05-03-2015, 12:28 AM
Post: #7
|
|||
|
|||
RE: an interesting problem
No solution found after testing 24 numbers.
Gerson. |
|||
05-03-2015, 12:33 AM
Post: #8
|
|||
|
|||
RE: an interesting problem | |||
05-03-2015, 12:42 AM
Post: #9
|
|||
|
|||
RE: an interesting problem
(05-03-2015 12:33 AM)Don Shepherd Wrote:(05-03-2015 12:28 AM)Gerson W. Barbosa Wrote: No solution found after testing 24 numbers. I would've said 22, but I didn't want to mislead anybody. I already knew 179 and 197 were both primes :-) |
|||
05-03-2015, 01:50 AM
Post: #10
|
|||
|
|||
RE: an interesting problem
I forgot to mention another restriction on the 3-digit number: it must contain 3 unique digits, that is, no repeating digits.
|
|||
05-03-2015, 02:29 AM
Post: #11
|
|||
|
|||
RE: an interesting problem
(05-03-2015 01:50 AM)Don Shepherd Wrote: I forgot to mention another restriction on the 3-digit number: it must contain 3 unique digits, that is, no repeating digits. Somehow I've assumed that restriction despite there was no reason to do so, which makes my quick solution completely wrong. In that case 113, 131 and 311 would be one solution. I will pay more attention next time :-) |
|||
05-03-2015, 03:10 AM
Post: #12
|
|||
|
|||
RE: an interesting problem
There can't be an even digit (or zero) since putting that digit in the final position results in a composite number. Likewise, we can't have a five. That leaves: 1, 3, 7 & 9 as possible digits.
Since we're not allowed repeated digits we have to check: Code: 137 For each of these four we need to check all digit permutations: Code: 137 So twenty four possibilities here. However by judiciously choosing composite numbers first, we can do it in with four tries Code: 371 More realistically, by starting at the top of each list of six and stopping when we find a composite, we have to make fifteen primality checks. - Pauli |
|||
05-03-2015, 03:51 AM
Post: #13
|
|||
|
|||
RE: an interesting problem
(05-03-2015 03:10 AM)Paul Dale Wrote: More realistically, by starting at the top of each list of six and stopping when we find a composite, we have to make fifteen primality checks. This is one of my lists: Code:
917 is the first composite, but the WP 34S PRIME? test is a joy to use, so much I would not stop until I had tested them all :-) Gerson. |
|||
05-03-2015, 05:07 AM
Post: #14
|
|||
|
|||
RE: an interesting problem
For fun here is a 34S program to solve this problem, albeit not optimally since it doesn't exclude fives. Runs virtually instantly. I'm sure there are a lot of space savings to be had here and probably some algorithmic ones too.
- Pauli Code: 01: LBL A |
|||
05-03-2015, 05:09 AM
Post: #15
|
|||
|
|||
RE: an interesting problem
This program checks twenty number for primality on a complete run.
This is worse than it could be due to the fives issue. - Pauli |
|||
05-03-2015, 05:42 AM
Post: #16
|
|||
|
|||
RE: an interesting problem
(05-03-2015 03:10 AM)Paul Dale Wrote: More realistically, by starting at the top of each list of six and stopping when we find a composite, we have to make fifteen primality checks. By using the divisibilty rule by 7 we have to make 20 checks: 137 -1 173 11 317 17 371 35 713 65 731 71 139 -5 193 13 319 13 391 37 913 85 931 91 179 -1 197 5 719 53 791 77 917 77 971 95 379 19 397 25 739 55 793 73 937 79 973 91 But then the check needs only a little mental arithmetic. By rearranging the numbers so that the first digit is last we have to make only 6 checks: 371 35 731 71 173 11 713 65 137 -1 317 17 391 37 931 91 193 13 913 85 139 -5 319 13 791 77 971 95 197 5 917 77 179 -1 719 53 793 73 973 91 397 25 937 79 379 19 739 55 Cheers Thomas |
|||
05-03-2015, 06:49 AM
(This post was last modified: 05-03-2015 12:10 PM by Don Shepherd.)
Post: #17
|
|||
|
|||
RE: an interesting problem
Thanks to all who participated.
I should have stated the restriction regarding duplicate digits in my original post. Gerson, however, read my mind. I couldn't fall asleep last night (tonight!) thinking that I had omitted something, then I realized it was no duplicate digits allowed. The maximum number of checks depends entirely on the order of the 6 entries in each of 4 lists: the 137 list, 139 list, the 379 list, and the 971 list. The best case is 4, as Pauli said, assuming you choose a composite number as the first member of each list. The worst case, it seems to me, would be 17, assuming you find all of the primes first in each list [3 primes in the 137 list, 2 primes in the 139 list, 4 primes in the 379 list, and 4 primes in the 971 list means tries = (3+1) + (2+1) + (4+1) + (4+1) = 17]. In my actual case, it was 12, but I went on and checked the remaining 12 numbers for primality too. Interestingly (to me at least, but then I'm weird), if we evaluate this for a 4-digit number instead of a 3-digit number, the number of permutations is the same [P(4,4)=24] and there is no solution as well. |
|||
05-03-2015, 03:23 PM
Post: #18
|
|||
|
|||
RE: an interesting problem
(05-03-2015 06:49 AM)Don Shepherd Wrote: Interestingly (to me at least, but then I'm weird), if we evaluate this for a 4-digit number instead of a 3-digit number, the number of permutations is the same [P(4,4)=24] and there is no solution as well. This appears to be a matter of probability. Sure there are about 1050 4-digit prime numbers, but in this one only group of 24 numbers it is very unlikely that all of them are primes. But indeed an overall interesting problem. Thanks for submitting it! |
|||
05-03-2015, 04:21 PM
(This post was last modified: 05-03-2015 04:22 PM by Don Shepherd.)
Post: #19
|
|||
|
|||
RE: an interesting problem
(05-03-2015 03:23 PM)Gerson W. Barbosa Wrote: in this one only group of 24 numbers it is very unlikely that all of them are primes Yeah, but it would have been special if one solution was found. Sort of like an odd perfect number. I wonder if someone will find one of those in my lifetime (I'm 64, time is running out ...). thanks Gerson |
|||
05-04-2015, 02:23 PM
Post: #20
|
|||
|
|||
RE: an interesting problem
(05-03-2015 06:49 AM)Don Shepherd Wrote: Interestingly (to me at least, but then I'm weird), if we evaluate this for a 4-digit number instead of a 3-digit number, the number of permutations is the same [P(4,4)=24] and there is no solution as well. How about in hex? We'd need to test up to 8-digit integers then... <0|ΙΈ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)