Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I can Predict your response with '90%' accuracy.

Status
Not open for further replies.

SidYuca

Technical User
Nov 13, 2008
79
MX
I Enjoyed this thread and thought that I'd contribute.

1. Multiply 2 single digits to form a product
2. Continue to multiply the resulting product by a single digit of your choice until said product is 7 digits (or more in length)
3. Circle one of the non-zero digits of the product (for me to guess) and post the remaining digits in any order.
4. I will post your circled digit..

Two questions: How? and give a mathematically valid reason for % accuracy.

 
I have finished calculating the possible missing digits of kwbMitel's ten problems. All but problems (1), (6) and (7) have either a unique source number, or multiple source numbers that happen to all have the same missing digit. So, for seven of the ten problems, it's possible to guess the missing digit with 100% certainty of being right. For the other three it's still a guess, but a guess with only two or three choices for the missing digit. So, even without making any assumptions about how kwbMitel chose his numbers, it's possible to guess the missing digit with a high probability of being right.

1 - 0, 0, 0, 3, 4, 9
2903040
4390400
9830400
possible missing digit {2, 4, 8}

2 - 0, 0, 1, 2, 2, 4, 6, 9
324060912
342921600
possible missing digit {3}

3 - 0, 0, 2, 6, 6, 6, 7, 8
266716800
106686720
possible missing digit {1}

4 - 0, 2, 4, 4, 5, 7, 8, 9
442968750
658409472
296475480
possible missing digit {6}

5 - 0, 2, 4, 6, 7, 7, 9
17694720
possible missing digit {1}

6 - 0, 0, 0, 2, 3, 4, 4, 6
206438400
263424000
442368000
possible missing digit {2, 8}

7 - 0, 0, 2, 3, 3, 6
3763200
4233600
possible missing digit {4, 7}

8 - 0, 0, 0, 2, 2, 5, 6, 9
200930625
229635000
296352000
326592000
possible missing digit {3}

9 - 0, 2, 6, 6, 7, 9, 9
29760696
69672960
possible missing digit {6}

10- 0, 0, 3, 3, 5, 6, 7
40353607
possible missing digit {4}
 
If you look at this puzzle from the point of view of being a competitive betting game, what the person who provides the clue would like is to be able to generate clues that give the person who is guessing the missing digit only a one in nine chance of being right. For example, consider what happens if the guesser is given the digits 0,0,0,1,2,5 and is asked to supply the missing digit. According to my calculations, 0,0,0,1,2,5 can be generated from 14 different source numbers. They are

1003520
1012500
1075200
1102500
1125000
1152000
1215000
1225000
1512000
2150400
3001250
3125000
5042100
6125000

So the missing digit must be one of {1, 2, 3, 4, 6, 7}. If the person who generates the clue always provides 0,0,0,1,2,5 as the clue and is careful to select the missing digit randomly, then the person who is guessing has only a one in six chance of being right.

So one unsolved question in this puzzle is whether there actually are clues of length (n-1) for which the missing nth digit can be any number between one and nine. If there are, then the person who is generating the clues can pick the numbers in such as way as to give the person who is guessing no more than a random chance of being right. If there are no such clues, then the guesser can always do better than random chance.
 
@SidYuca - I don't write code except in very limited circumstances. My interest is in the puzzle which I find very satisfying.

Figuring out how this is done was taken care of by Karluk so that issue is dead. I've now moved on to verifying the 90% number

I thought I saw a flaw that could be exploited to the dis-advantage of the Guesser. Specifically, the Guesser can only be correct if he is correct 9 or 10 times out of 10. The non-guesser wins in the other 8 cases. I was investigating whether your method of averaging was causing an issue, whereby the non-guesser could win more short trials but the Guesser averages 90% in the long run.

This turns out not to be true.

Initially, I was averaging 97% in my data. This turned out to be because I was always multiplying at least 12 digits regardless of the resulting size of the product. I modified my method to only produce 7 digit numbers and the average then reduced to maginally over 90%. This is where I asked you whether you are only using 7 digits numbers to produce 94% (A question you have not answered by the way)

Suffice it to say I am satified that the puzzle works as presented (if not your specific results). I am thinking about ways to calculate the odds mathmatically but the variable quantity of numbers needed to generate a 7 digit product is complicating matters for me.

@Karluk - your 67% number does not agree with my data either. How did you come by that number?

**********************************************
What's most important is that you realise ... There is no spoon.
 
@ Karluk re:67% - Did you remove the primes before calculating?

**********************************************
What's most important is that you realise ... There is no spoon.
 
kwbMitel said:
your 67% number does not agree with my data either. How did you come by that number?
I arrived at my numbers by brute force calculation. There are a total of 882 numbers between 1,000,000 and 9,999,999 whose prime factorization involves only the primes 2, 3, 5, 7. Of these, 591 are divisible by nine. 591/882 = 67.0% (approximately)

Similarly, there are 1272 eight digit candidates, of which 896 are divisible by nine, and 1767 nine digit candidates, of which 1293 are divisible by nine.

Where both you and SidYuca are erring is making assumptions about what is being asked for that are in no way present in the statement of the problem. Take a look back at SidYuca's original post, which reads in part

SidYuca said:
Continue to multiply the resulting product by a single digit of your choice

It specifically says that the selection of which digit to multiply by is the choice of the person generating the clue. Both you and SidYuca are incorrectly reading this as instructions to "Continue to multiply the resulting product by a randomly selected single digit", or words to that effect. But "single digit of your choice" means exactly that - I, as clue generator, can pick any product of single digits that I want to. If I choose to multiply in a way that generates a hard-to-guess clue, that's my choice, not the choice of the person who is guessing. So, I can always multiply in a way that allows me to present 0,0,0,1,2,5 as the clue and with equal chances that the missing digit is 1, 2, 3, 4, 6 or 7. That will give the guesser only a one in six chance of being right. If I can find a clue with more than six possible missing digits, I can give the guesser an even smaller chance of being right.
 
{quote]Where both you and SidYuca are erring is making assumptions about what is being asked for that are in no way present in the statement of the problem.[/quote]

Actually no, I am simply trying to calculate the odds in an unbiased game. Validating the 90% claim so to speak. My data concludes that 90% is achievable when the data is random.

You are trying to calculate the best possible odds for the contestent.

For the record, my first attempt at choosing non-random numbers was 7^8 which would have won for me. I would have continued this pattern choosing X^Y to achieve 7 digit numbers. I would have won 5 out of 8 of these. (2^20,4^11,5^10,7^8,8^7)
If the guesser thought I was just being lucky and continued I would have then chosen the remaining unique combinations from my winning numbers

2 Wins 6 ways
4 wins 4 ways
5 wins 5 ways
7 wins 6 ways
8 wins 5 ways

By the end of this series I will have won 26 of 29 and won no less than 21 in a row. Suffice it to say that non-random is pointless.

**********************************************
What's most important is that you realise ... There is no spoon.
 
kwbMitel said:
Actually no, I am simply trying to calculate the odds in an unbiased game.
Actually yes. There is nothing unbiased about the game you are analyzing. You are analyzing a game where the person guessing the missing digit is allowed to dictate how the clues will be generated. No doubt there is potential for the guesser to achieve a 90% success rate in such a game, but the problem is that the game is inherently biased. Analyzing an unbiased game requires one to analyze what happens when each player is employing his optimal strategy. All you've proven is that multiplying together randomly selected single digits is NOT the optimal strategy of the person generating the clues.

kwbMitel said:
my first attempt at choosing non-random numbers was 7^8 which would have won for me...Suffice it to say that non-random is pointless.
It's NOT pointless. I showed in an earlier post that your tenth clue, generated from 7^8, is one of the seven where it's CERTAIN that the guesser will win, if he guesses "4" as the missing digit. That's because the 0, 0, 3, 3, 5, 6, 7 clue you posted from 7^8 happens to be one that only has a single source number. A guesser employing his optimal strategy would know this and would not have guessed "3" based on the "evenly divisible by nine" strategy, which he already knows is the wrong answer.

Incidently, the 7^8 example also shows that the "evenly divisible by nine" guessing strategy is NOT optimal for the guesser. There are cases where it's provable that guessing "evenly divisible by nine" will fail, and the guesser needs to be aware of this situation and not make an obviously wrong guess.
 
One minor correction: kwbMitel's tenth clue is generated from 7^9, not 7^8. Just pointing this out to avoid potential confusion.
 
Looks like I have a lot to write about.

Karluk is correct in his interpretation single digit. This was not my intention. I should have written 'any". I misquoted the source, Sorry about that.

I also like his statistical approach. I hope his data is not correct because that makes me wrong.

Kwbmitel

You said in part:
1. I multiply the numbers by 1 another until I achieve a 7 digit number.
2. I use the first digit as my "unknown" digit
3. The rest are used to regenerate the number...."
I understand 1 & 2 but not 3. Why do you feel the need "The rest are used to regenerate the number...."
Do you mean by "regenerate" mix the remaining 6 digits to for me to guess the first number? The mixing is just a distraction.

Sorry I missed your question.. i.e. This is where I asked you whether you are only using 7 digits numbers to produce 94%

Answer. I started with a product=1 and Then multiplied by a rnd between 2-9 to form a new product. Each time I checked if the product mod 9 = 0 and if it did I broke out of the loop
which constrained the length of the product string was less than 8. I didn't trim the sign.





Karluk

you said in part
According to my calculations, 0,0,0,1,2,5 can be generated from 14 different source numbers. They are
1003520
followed by a 13 more contrived numbers. I say contrived because I did a prime factorization of the first number and see that it is
2^12*5*7^2... Congrats. By selecting 15 (FIFTEEN ) rnd primes from 2,3.5 and 7 you have managed not to hit a pair of 3's
Needlessly to say I did not bother with the remaining 13 but did inspect them to see that six of them have 9 as a factor and if you by chance happen to select one of these my 1 in 6 becomes 100%



 
@Karluk, Ok, Pointless was somewhat harsh. You are pursuing a course whereby both the guesser and contestant can employ optimal stategies to determine a percentage of correct guesses. This has value for sure I will probably dig into that at some point.

What I am trying to do is investigate SidYuca's original strategy against random data to gain a baseline for his original assertion. Against random data, he looks good so far. I'm simply trying to locate what appears to be a discrepancy of some sort.

@ SidYuca, Re:the rest are used to regenerate the (missing) number.

The order of the remaining digits is meaningless. The method requires that they be added together and the total subtracted from the nearest multiple of 9 that is greater than the total. This number will equal the "Missing" number 90% of the time (when numbers are random). This question led me to find an error in my formulas. I've found that I did not copy my formula's completely thru the 50,000 trials. Only the first 100 lines were correct. As such I was not always using the 7 digit numbers but the calculations were based on only 8 digits being multiplied. I now get 94% using 7 digit numbers. Moving on.

**********************************************
What's most important is that you realise ... There is no spoon.
 
@ Karluk. Do you have a shortcut method for calculating divisibility by 7 or are you relying on a computer.

I know of shortcuts for all other digits 1 - 12 but 7 has always eluded me. This is the primary reason I chose 7^9 earlier (thanks for the correction btw).



**********************************************
What's most important is that you realise ... There is no spoon.
 
There isn't any really great test for divisibility by seven. The only one I've seen that I thought worth remembering is based on the fact that 1001 is evenly divisible by seven. That allows one to group the digits of a long number into triplets and then alternately add and subtract triplets. The original number is divisible by seven if and only if the sum is also divisible by seven.

To take a concrete example, use the test to determine the divisibility by seven of 40,353,607 = 7^9. Of course we already know it's divisible by seven because it's an exact power, but we just want to verify the validity of the test. Separate 40,353,607 into the triplets (40), (353) and (607) and then alternately add and subtract. The resulting sum is

40 - 353 + 607 = 294 = 2*3*7^2

So the test tells us that 40,353,607 is divisible by seven, if we didn't already know that.

The value of this test is limited for numbers like 40,353,607, which is only eight digits long. But it can be used to test numbers with thousands of digits without having to do long division.
 
Oh, one other thing - 1001 is not just divisible by seven. It is the product of 7*11*13. So the same test of alternately adding and subtracting triplets is also a test for divisibility by 11 and 13. In the example above, since 294 is not divisible by either 11 of 13, we know immediately that 40,353,607 is not divisible by either 11 or 13. That's the main reason I decided the test was worth remembering. Even though it's cumbersome to implement, it simultaneously tests for divisibility by three different small primes. I've always liked the idea of getting three for the price of one.
 
kwbMitel
There are tests for divisibility for all prime numbers! Problem is that the test for them are many times more painful than the actual division.
One test for divisibility by 7 goes like this:

Subtract twice the last digit from the number formed by the remaining digits. Continue doing this (recursive) until such time that you recognize that the number is small enough to see that 7 is (or is not) a factor.
Examples:
63 -> 6-2*3 = 0 and this is divisible by 7 so 63 is also.
1645-> 164-2*5= 154 -> 15 - 2*4 = 7 BINGO

I use a divisibility rule for 13 in my Maya calendar studies where one of their cycles is a modified base 20 number, but the similar method for 13 (or any prime0 works as well in any base.



 
Her's another for divisibility by 7 (involves multiplication by 3):

A number of the form 10x + y has the same remainder when divided by 7 as 3x + y. So get the leftmost digit of the original number, multiply by 3, add the next digit, get the remainderfrom division by 7 (i.e. mod7)mod7 continue
For example, the number 1645:
(3*1 + 6) mod7 = 2
(3*2 + 4) mod7 = 3
(3*3 + 5) mod7 = 0 Bingo.
Nice part about this one is that if not a multiple of 7 then you are left with the mod


3×3 + 7 = 16 remainder 2, and 2×3 + 1 = 7. This method can be used to find the remainder of division by 7.
 
karluk Said:

"There are a total of 882 numbers between 1,000,000 and 9,999,999 whose prime factorization involves only the primes 2, 3, 5, 7."

I know you said that you got these by brute force. I need a bigger brute.

Please, I am interested
1* How did you determine this fact (code, a pgm or net resource?
2* Would you post the 882 of them or tell me where I could all them?
3* Do EACH of these 882 contain the 4 primes i.e. 2 and 3 and 5 and 7?


 
SidYuca - When I say shortcut method, I am taking about methods that can be done in your head - quickly. I have never found any of those that are suggested for 7 to be simple. The method being employed in this puzzle to determine divisibility by 9 is one that I commonly use.

The most complicated one I know that I still consider simple is for divisibility by 11.

Add alternate digits in the number, add the remaining digits, subtract the smaller number from the larger and check for divisibility by 11. A result of zero also indicates divisibility

is 1061965873628 divisible by 11

8+6+7+5+9+6+1 = 42
2+3+8+6+1+0 = 20
42-20 = 22 = divisible by 11

**********************************************
What's most important is that you realise ... There is no spoon.
 
Sometimes when you go to the doctor the cure is often worse than the disease. If you want simple then stick to divisibility by 10. As the divisor increases so does the shortcut. As you are interested in the math I should think that it would be the REASON why the rule works rather than the speed and ease that would interest you as you demonstrated by your interset in the original problem. The divisibility by 7 is certainly one to do in your head. As a matter of fact you may replace 7's, 8s and 9'd in your 'to test number' by 0'1 and 2 respectively.

re. the diviibility rule for 9, you need not sum all the numbers and look for next mult of 9 that is greater etc. You may:
* Cast out all combos of 9 first. i.e. in
23487
1. Don't consider the (234) because sum = 9
2. take the 8+7 and get 15 and then add the 1+5 to get the 6.

Thus any combo of digits 23487 mod 9 = 6

Not many of the list will know that casting out of 9's was taught in grade school for basic operations when I was in grade school way back then.

ie. if you wanted to check if
43 * 264 = 11,452 cast out 9's in each term
7 * 3 ? 4
21 ? 4
3 < 4 ..Product is FALSE
However the converse is not always TRUE due to the possibility of a transposition of digits.

NOTE: Your 'easy' test for 11 uses a similar principal as does the test for 7...as may be used for all primes. Try to figure it out w/o reference to the literature.


 
As the forum is 'Puzzles for Programmers' I thought I would right some python code & see just how often numbers produced in this fashion are divisible by 9 (the key to the trick)

Code:
    count=0.0
    sample=1000000
    for x in xrange(sample):
        result=random.randint(1,9)
        while len(str(result))<7:
            result=result*random.randint(1,9)
        if result%9==0:
            count +=1
    print count/sample*100
Interestingly larger sample sizes tend towards 94%

Computers are like Air conditioners:-
Both stop working when you open Windows
 
SidYuca said:
1* How did you determine this fact (code, a pgm or net resource?
My professional background is Oracle database, so I wrote a pl/sql procedure to populate an Oracle table with the numbers.
SidYuca said:
2* Would you post the 882 of them or tell me where I could all them?
Posting all 882 numbers would clutter up this thread too much. Instead I'll post the subset between 1,000,000 and 1,499,999. In this range there are 128 numbers, of which 85 are divisible by nine. 85/128 = 66.4%
SidYuca said:
3* Do EACH of these 882 contain the 4 primes i.e. 2 and 3 and 5 and 7?
Of course not. There is no requirement in the clue construction process to make sure that the product includes all the primes 2, 3, 5, 7. The only requirement is that no larger prime be allowed.

Here are the 43 numbers between 1,000,000 and 1,499,999 that are not divisible by nine. I've included the number itself, followed by the exponents of 2, 3, 5 and 7 in the prime factorization of the number:

1000000 6 0 6 0
1003520 12 0 1 2
1008420 2 1 1 5
1024000 13 0 3 0
1029000 3 1 3 3
1048576 20 0 0 0
1050000 4 1 5 1
1053696 10 1 0 3
1071875 0 0 5 3
1075200 11 1 2 1
1075648 6 0 0 5
1093750 1 0 7 1
1097600 7 0 2 3
1120000 8 0 4 1
1146880 15 0 1 1
1152480 5 1 1 4
1171875 0 1 8 0
1176000 6 1 3 2
1176490 1 0 1 6
1200000 7 1 5 0
1200500 2 0 3 4
1204224 13 1 0 2
1225000 3 0 5 2
1228800 14 1 2 0
1229312 9 0 0 4
1250000 4 0 7 0
1254400 10 0 2 2
1260525 0 1 2 5
1280000 11 0 4 0
1286250 1 1 4 3
1310720 18 0 1 0
1312500 2 1 6 1
1317120 8 1 1 3
1344000 9 1 3 1
1344560 4 0 1 5
1372000 5 0 3 3
1376256 16 1 0 1
1400000 6 0 5 1
1404928 12 0 0 3
1411788 2 1 0 6
1433600 13 0 2 1
1440600 3 1 2 4
1470000 4 1 4 2


And here are the 85 numbers between 1,000,000 and 1,499,999 that are divisible by nine:

1000188 2 6 0 3
1008000 7 2 3 1
1012500 2 4 5 0
1016064 8 4 0 2
1020600 3 6 2 1
1032192 14 2 0 1
1036800 9 4 2 0
1037232 4 3 0 4
1049760 5 8 1 0
1058400 5 3 2 2
1058841 0 2 0 6
1062882 1 12 0 0
1063125 0 5 4 1
1071630 1 7 1 2
1080000 6 3 4 0
1080450 1 2 2 4
1088640 7 5 1 1
1093500 2 7 3 0
1102248 3 9 0 1
1102500 2 2 4 2
1105920 13 3 1 0
1111320 3 4 1 3
1119744 9 7 0 0
1125000 3 2 6 0
1128960 9 2 1 2
1134000 4 4 3 1
1143072 5 6 0 2
1148175 0 8 2 1
1152000 10 2 3 0
1157625 0 3 3 3
1161216 11 4 0 1
1166400 6 6 2 0
1166886 1 5 0 4
1179648 17 2 0 0
1180980 2 10 1 0
1181250 1 3 5 1
1185408 7 3 0 3
1190700 2 5 2 2
1209600 8 3 2 1
1210104 3 2 0 5
1215000 3 5 4 0
1224720 4 7 1 1
1234800 4 2 2 3
1240029 0 11 0 1
1244160 10 5 1 0
1250235 0 6 1 3
1259712 6 9 0 0
1260000 5 2 4 1
1265625 0 4 6 0
1270080 6 4 1 2
1275750 1 6 3 1
1285956 2 8 0 2
1290240 12 2 1 1
1296000 7 4 3 0
1296540 2 3 1 4
1306368 8 6 0 1
1312200 3 8 2 0
1323000 3 3 3 2
1327104 14 4 0 0
1333584 4 5 0 3
1350000 4 3 5 0
1354752 10 3 0 2
1360800 5 5 2 1
1361367 0 4 0 5
1366875 0 7 4 0
1377810 1 9 1 1
1378125 0 2 5 2
1382400 11 3 2 0
1382976 6 2 0 4
1389150 1 4 2 3
1399680 7 7 1 0
1406250 1 2 7 0
1411200 7 2 2 2
1417176 3 11 0 0
1417500 2 4 4 1
1428840 3 6 1 2
1440000 8 2 4 0
1451520 9 4 1 1
1458000 4 6 3 0
1469664 5 8 0 1
1474560 15 2 1 0
1476225 0 10 2 0
1481760 5 3 1 3
1488375 0 5 3 2
1492992 11 6 0 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top