Problems & Puzzles: Puzzles

Puzzle 63.- Another (3rd) Mike Keith's little puzzle.

Take an n-digit integer and construct all the possible expressions you can that use the individual digits of the number combined with parentheses and the operators +, -, *, and /. (Note: just to be clear, because people sometimes get confused with this kind of problem, NO other operators are allowed - no exponentiation, no concatenation of digits, nothing.)

If you calculate the values of these expressions, some will be non-integers, some will be negative, etc, but just take those that are (positive) prime numbers. Then find which range of consecutive primes starting with 2 is included in the set. Call the last prime in the range P(n).

Now...define a(n) as the largest value of P(n) for any n-digit integer. What are the values of a(n), and which primes produce them?

Here are the answers for the first few n. Note that without loss of generality, we can examine just n-digit integers whose digits in order are non-decreasing. So that's the way I've listed them below.

n=2: 12, 13, or 36 generate 2...3; so a(n) = 36
n=3: a(n) = 237 generates 2...23
n=4: a(n) = 3579 generates 2...71
n=5: a(n) = 45679 gives 2...317
n=6: a(n) = 567889 gives 2…1033

Here is n = 3 in detail:

2 = 7-3-2
3 = (7+2)/3
5 = (7+3)/2
7 = 7*(3-2)
11 = 2*7 - 3
13 = 2*3 + 7
17 = 2*7 + 3
19 = 7*3 - 2
23 = 7*3 + 2

a) Can you obtain the details for n = 4, 5 & 6

b) Can you calculate a(n) for n= 7, 8 & 9?


Jim R. Howell sent (10/07/99) the details for n = 4 (calculated 'by hand'):
2  = (7+9)/(3+5); 3  = (9-3)/(7-5); 5  = 5*(3+7-9); 7  = 7*(9-5-3); 11 = (7+3)/5+9; 13 = 5*3+7-9; 17 = 5*3+9-7; 19 = (9-5)*3+7; 23 = 7*5-3-9; 29 = 7*5+3-9; 31 = 5*3+7+9; 37 = (9-3)*5+7; 41 = 7*5+9-3; 43 = (9+7)*3-5; 47 = 7*5+3+9; 53 = (9+3)*5-7; 59 = (7+3)*5+9; 61 = 9*7+3-5; 67 = (9+3)*5+7
71 = 9*7+5+3.

***

Giorgos Kalogeropoulos wrote on June 8, 2023:

Puzzle 63:
a) n=5, 
    2 = -(9+6*4-5*7) , 3 = 6-(5*4+7)/9 , 5 = (9+5*6-4)/7 , 7 = 6-(7*5-4*9) , 11 = -4*9+7*6+5 , 13 = -4*5-9+7*6 , 17 = 5*7-(6-4)*9 , 19 = 7*4-(6-5)*9 , 23 = 6*9-5*(7)+4 , 29 = 9+5*(7-6)*4 , 31 = -(7-6*4)+9+5 , 37 = 9*7-4*5-6 , 41 = 7+(6*9-4*5) , 43 = 4*9-(5-6)*7 , 47 = 5+4/6*9*7 , 53 = 6*7-9+4*5 , 59 = 9*4+5*6-7 , 61 = 7+(5-4)*6*9 , 67 = 7*4-6+(5*9) , 71 = 9+4*5+7*6 , 73 = 6*5+9*4+7 , 79 = 5*9+4*7+6 , 83 = -4+(7*6+5*9) , 89 = 5*4+6+9*7 , 97 = 5*6+4+9*7 , 101 = 4*9+(6+7)*5 , 103 = 7-(5-9)*6*4 , 107 = 9-(6-4*5)*7 , 109 = 9*6+(7+4)5 , 113 = 7*(5+6)+9*4 , 127 =  7*4+(6+5)*9 , 131 = -(4-6)*7*9+5 , 137 = 6-(9-5*7*4) , 139 = (7+5*6)*4-9 , 149 = -7+(9+5*6)*4 , 151 = (9*4-7)*5+6 , 157 = (9-4)*6*5+7 , 163 = 7-(6-5*9)*4 , 167 = -6+4*5*9-7 , 173 = -9+(6+4*5)*7 , 179 = 4*5*9+(6-7) , 181 = -7*5+(6*9)*4 , 191 = -(4-5*6)7+9 , 193 = 7+6+5*4*9 , 197 = -9+7*6*5-4 , 199 = (6*7-4)*5+9 , 211 = 4+(6*5-7)*9 , 223 = 4+9+(7*6*5) , 227 = (6+4*5)*9-7 , 229 = -7+(5+9*6)*4 , 233 = 5+(9*7-6)*4 , 239 = -7+(4*9+5)*6 , 241 = -(5-9*7*4+6) , 251 = +5-6+(4*7)*9 , 257 = 7+5*(9*6-4) , 263 = 5+(6+9*7*4) , 269 = (6*5+9)7-4 , 271 = (6+9*7)*4-5 , 277 = 4+(9*5-6)*7 , 281 = 4+7+(9*5*6) , 283 = (6*9+4)5-7 , 293 = (9*5-4)*7+6 , 307 = 7+(6+9)5*4 , 311 = 9*(6+7*4)+5 , 313 = 7*5*9-(6-4) , 317 = 7*9*5-4+6.

 

 
n=6,
2 = -9*7+8*8+6-5 , 3 = 9*5-6*7*8/8 , 5 = -6+8*9-5-8*7 , 7 = (7*8-5)/9+8/6 , 11 = 5+6*9-7*8+8 , 13 =  6+(9/8*8-7+5) , 17 = 5+(8*9/8-7)*6 , 19 = 9*6-5/8*7*8 , 23 =  8-(5-6*9)/7+8 ,29 =  9*6-8*5+8+7 , 31 = (5+8)*6+9-7*8 , 37 = 7*9+6+8-5*8 , 41 = 7+8*9-6*5-8 ,43 = 6*8-8+5+7-9 , 47 =  5*6+8/8+9+7 , 53 =  5+6*9+8/8-7 , 59 =  9*5*(8-7)+6+8 , 61 = 8/6*9*8-7*5 , 67 =  6+8*8-7-5+9 , 71 = (9+5-6+7/8)*8 , 73 = 7*8+5+9/6*8 , 79 = -7-8+(5*8+9*6) , 83 =  8-5*(6*8-9*7) , 89 = 8*6*9/8+7*5 , 97 = 8*9 7/6+8+5 , 101 = -(8-8*5-6)+7*9 , 103 = -7+5*6+9*8+8 , 107 =  9-5+6*(8+8)+7 , 109 =  9+(7+8)*8*5/6 , 113 = 5*8+7+9*8-6 , 127 =  5+8*9+8*7-6 , 131 = 9*8/6*8+7*5 , 137 = 7*8-(5-8-6)*9 , 139 = -8/8+(9+5+6)*7 , 149 = 8+(8+5)*6+7*9 , 151 = 6*7+(5+8)*9-8 , 157 = (7+8*9/6)8+5 , 163 = 8+8-(9-5*6)*7 , 167 = 6-7*(9+8-5*8) , 173 = 6*5+7+(8+9)*8 , 179 = 7*5-(6-8)*8*9 , 181 = 5-8*7*(6-9)+8 , 191 = 8*(7+6-8)*5-9 , 193 = (9/8+6*5-7)*8 , 197 = 7-8-(8-6*5)*9 , 199 = -8*8+(6*5)*9-7 , 211 = 8+(8+6*5-9)*7 , 223 = -9+(5*8*7-8*6) , 227 = -6+7*(5*8-8)+9 ,229 = (6*8+9)5-7*8 , 233 = 5*8*6+7*(8-9) , 239 = -(9-7*8+8)*6+5 , 241 = -(6-7*5-9/8)*8 , 251 = 7*6*8-5*(9+8),257 = -(8-9*5)*7+6-8 , 263 = 9*6*5-(8*7)/8 , 269 = 6-9+7*8*5-8 , 271 = 8*8-(7-6*5)*9 , 277 = 7+8/8*9*6*5 , 281 = (5*8+7)*6-9+8 , 283 = -8-9*5+8*7*6 , 293 = 7+5*6*9+8+8 , 307 = 6*8+(5*9-8)*7 , 311 = 7+(5*9-6)*8-8 , 313 = (6-8+9*7)5+8 , 317 = -8+(8-6+7*9)5 , 331 = 5*(8-9)+7*8*6 , 337 = (8+8)+6+9*7*5 , 347 = (9+8*7-8)*6+5 , 349 =  9*(7*6-5)+8+8 , 353 = -6+8*5*9+7-8 , 359 =  7+8*(5+6*8-9) , 367 =  8+(5*8*9-7+6) , 373 = 8*(6*9*7-5)/8 , 379 =  8-5-(7-6*9)*8 , 383 = 8+(6*9*7)+5-8 , 389 = (6*9*8-8-5*7) , 397 = (6/8+9)5*8+7 , 401 = 6*8+8*9*5-7 , 409 = -7+8*(6+5*9)+8 , 419 = (7+6*9-8)*8-5 , 421 = (5*9+6)*7+8*8 , 431 = (5+8*7-6)*8-9 , 433 = 6+(8+5*9+8)*7 , 439 = 8*8*7-(6-5)*9 , 443 = 5-(7-8*9-8)*6 , 449 = 6+(8*9-8)*7-5 , 457 = 9+(6-5)*8*8*7 , 461 = -7*5+(9*6+8)*8 , 463 = (8+6 9-5)*8+7 , 467 =  8*(5*7/8+6*9) , 479 = 8*6*9+7+8*5 , 487 =  9*5+(8*7*8-6) , 491 = (5+9*8)*7-6*8 , 499 = 6+(9*5+8*8*7) , 503 = 5*(7+6)8-9-8 , 509 = 7+(9+8)*6*5-8 , 521 = (6+8*7-5)*9+8 , 523 = 6+5+8+9*7*8 , 541 = (6/8+9)8*7-5 , 547 = 6*8+8*9*7-5 , 557 = 8*7*9+(8*6+5), 563 = 8+(9*7+6*8)*5 , 569 = (8-6)5*7*8+9 , 571 = 8*8*9+5/(6-7) , 577 = 9+(7+5)*6*8-8 , 587 = -8/8+(5+9)*7*6 , 593 = 6-8+5*7*(9+8) , 599 = 5*6-7+9*8*8 , 601 = 7+(8+8-5)*9*6 , 607 = -9+(5*8+8*6)*7 , 613 = (7+8*9*8)+5*6 , 617 = -8+(6+5)8*7+9 , 619 = (5+8)*(6*9-7)+8 , 631 = 5-6+8*(9*8+7) , 641 = (7+6)5+8*9*8 , 643 = (6*8+9 5)7-8 , 647 = 7+8*(9+6-5)8 , 653 = 5+(7+8-6)8*9 , 659 = 8*(6+9*8)+7*5 , 661 = 7+6*(8*8+5*9) , 673 = 9+(7*5+8*6)*8 , 677 = 5+(8*8*7*9)/6 , 683 = -7-5(6-(8+8)9) , 691 = 6-5(7-(8+8)*9) , 701 = 6*9*(5+8)+7-8 , 709 = 8+(5+6)*9*7+8 , 719 = 9*(8+8)*5+6-7 , 727 = 7+9*(8-6)8*5 , 733 = 7+6+(8+8)*9*5 , 739 = 7*(6+8)8-5*9 , 743 = 6+8*7*(8+5)+9 , 751 = 7+(9*5+8*6)*8 , 757 = (5+6)*9*7+8*8 , 761 = 5*(8+6+8)7-9 , 769 = 7*(8*8+9*5)+6 , 773 = 5+6*(7*8+9*8) , 787 = -9*5+8*(6+7)*8 , 797 = -5-8+(7+8)*9*6 , 809 = (9*8+6*5)*8-7 , 811 = (8(9+7)+8)6-5 , 821 = 8-6+(5+8)9*7 , 823 = 8+5+(8+7)*9*6 , 827 = (6+9)7*8-5-8 , 829 = 7*(6+8)*8+9*5 , 839 = -7+(8*8+6*5)*9 , 853 = 7+(6*5+8*8)*9 , 857 = (8*(5+6)+8)9-7 , 859 = -5-9*(8-(7+6)*8) , 863 = 5+(9(7+8)+8)*6 , 877 = 8*8*(6+7)+5*9 , 881 = 6+(9+8+8)*7*5 , 883 = (9*7+6 8)*8-5 , 887 = (5+(8+8)9)*6-7 , 907 = -5+8*(6*7+8*9) , 911 = (7+(8+8)9)6+5 , 919 = -8+(7(8+6)+5)*9 , 929 = (8+5)*(8+7*9)+6 , 937 = 9*(7+8+6)*5-8 , 941 = (7*8+8*6)*9+5 , 947 = -5-8(7-(8+6)*9) , 953 = -7+8*8*5*(9-6) , 967 = 7-(6-9)5*8*8 , 971 = -5-8(6-(9+7)8) , 977 = -7+8*(6+(5+8)*9) , 983 = -7+(6+8+8)5*9 , 991 = 7+(9(5+8)+6)*8 , 997 = (8+8)*9*7-6-5 , 1009 = 6+(8+8)9*7-5 , 1013 = (8-6)8*9*7+5 , 1019 = 5+6+(8+8)*7*9 , 1021 = 8(7+(6+9)8)+5 , 1031 = 5-9(6-(7+8)*8) , 1033 = (7+8*9)*(8+5)+6

 


Records   |  Conjectures  |  Problems  |  Puzzles