Friday's Puzzle

T

toasty

Ok,

Interesting puzzle, for those who think they are up to it.

I'd be interested to see Empip's solution, he seems a clever chap. :D


Consider expressions formed from the numbers 1, 2, 3 & 4
(of which each is to used exactly once)
and the symbols +, -, * (addition, subtraction & multiplication).

Example:

To make 1 you could say (2*3)-(4+1) so the number 1 can be represented.
Note: 1 = (2+3)-4 would not be a valid as it does not use the number 1 (you have to use 1, 2, 3 and 4 exactly once)

More examples below:
2 = (2 * 3) - ( 4 * 1)
3 = ( 1 * 2 ) - 3 + 4
4 = 1 + 2 - 3 + 4
5 = 4 + 1 * ( 3 - 2 )
6 = 4 + 3 - 2 + 1
etc...

Question 1) What is the smallest positive number that cannot be represented by such expressions involving 1, 2, 3 & 4?

Note: You are allowed to reuse operators i.e 1+2+3+4 is allowed.
But you are not allowed to join digits together (32+14).



Question 2) Find a another set of 4 positive numbers (to replace 1,2,3 & 4)such that the smallest positive number that cannot be represented is greater than the answer to question 1. i.e a 'better' set of numbers

For example, using 1, 10, 11 and 12 it's impossible to make the number 1. So that would be no good.

Using 3, 4, 6 & 8 you can make all the numbers from 1-11 i.e

1 = 3 - 4 + (8 - 6)
2 = 3 * (4 - 6 +:cool:
3 = 4 - 3 - 6 + 8
4 = 4 * (3 + 6 -:cool:
5 = 6 - 8 + 4 + 3
6 = (3 * 6) - 4 - 8
etc... etc...
(however using 1,2,3&4 you can do better than this, so that's not the answer either)


Question 3) (for the really interested) What is the ultimate set of 4 numbers? i.e which set of 4 enable you to make the longest series of uninterupted numbers from 1 - ???


For what it's worth, I think I have the correct answer to all 3 questions, but it's taken me hours to find them.. (and lots of CPU cycles!!)

-Dan
 
Sponsored Links
Come on Breezer, I tried to help you with your nut in pipe problem the other day!! :LOL:
 
Sponsored Links
A quicky answer to Q1, back of Woodbine packet job...

Where a1=1 b1=2 c1=3 d1=4

c1+b1-(d1+a1) = 0
b1+c1-d1*a1 = 1
a1+b1+c1-d1 = 2
d1+b1-c1*a1 = 3
a1+d1+b1-c1 = 4
d1+c1-b1*a1 = 5
a1+c1+d1-b1 = 6
(d1+c1)*(b1-a1) = 7
b1+c1+d1-a1 = 8
d1*c1-b1-a1 = 9
a1+b1+c1+d1 = 10
d1*c1-b1+a1 = 11
d1*c1*(b1-a1) = 12
d1*c1+b1-a1 = 13
d1*c1+b1*a1 = 14
d1*c1+b1+a1 = 15
d1*(c1+b1-a1) = 16
(d1+b1)*c1-a1 = 17
d1*(c1+a1)+b1 = 18
d1*(b1+c1)-a1 = 19
d1*(b1+c1)*a1 = 20
d1*(b1+c1)+a1 = 21
(d1*c1-a1)*b1 = 22
b1*c1*d1-a1 = 23
a1*b1*c1*d1 = 24
b1*c1*d1+a1 = 25
(d1*c1+a1)*b1 = 26
(d1*b1+a1)*c1 = 27
d1*(b1*c1+a1) = 28
29 Cannot be computed hence is smallest number.

Busy now, going outside - may be gone some time ....
:D :D
 
Spot on, well at least it agrees with my answer.

Like you, I did it by hand but checked it using a perl script I wrote, so I'm fairly sure it's right.

As for question 2 and 3 though, I'm not sure it can be done without a computer, again I used perl, but I reckon Excel would be just as useful (if maybe slower) My answer to question 3 took 24 hours to compute running on a 1Ghz AMD running redhat. :oops:

Anyway, gold star for empip!

-Dan
 
empip said:
Where a1=1 b1=2 c1=3 d1=4

c1+b1-(d1+a1) = 0
b1+c1-d1*a1 = 1
a1+b1+c1-d1 = 2
d1+b1-c1*a1 = 3
a1+d1+b1-c1 = 4
d1+c1-b1*a1 = 5
a1+c1+d1-b1 = 6
(d1+c1)*(b1-a1) = 7
b1+c1+d1-a1 = 8
d1*c1-b1-a1 = 9
a1+b1+c1+d1 = 10
d1*c1-b1+a1 = 11
d1*c1*(b1-a1) = 12
d1*c1+b1-a1 = 13
d1*c1+b1*a1 = 14
d1*c1+b1+a1 = 15
d1*(c1+b1-a1) = 16
(d1+b1)*c1-a1 = 17
d1*(c1+a1)+b1 = 18
d1*(b1+c1)-a1 = 19
d1*(b1+c1)*a1 = 20
d1*(b1+c1)+a1 = 21
(d1*c1-a1)*b1 = 22
b1*c1*d1-a1 = 23
a1*b1*c1*d1 = 24
b1*c1*d1+a1 = 25
(d1*c1+a1)*b1 = 26
(d1*b1+a1)*c1 = 27
d1*(b1*c1+a1) = 28
29 Cannot be computed hence is smallest number.
Why all the 1's? They weren't nessecary, AFAICT.
 
Back of a 'fag packet'?? Somewhat true, always place a square of cigarette packet under each 'foot' of computer ....

Used Excel.
I reckon with a lump of VB chucked in it would be quite feasible to do a quickie.

I saw, 4 separate numbers...
Three separations by 3 arithmetic operators + - *
Therefore without brackets, 3³ combinations of operators = 27 lines in spreadsheet.

Then 6 combinations using brackets.

(1#2)#3#4
1#(2#3)#4
1#2#(3#4)
(1#2)#(3#4)
(1#2#3)#4
1#(2#3#4)

Therefore there are 7 x 27 = 189 total combinations, (189 spreadsheet lines) which will include negative numbers and repetitions.

Using VB Could increment the number set, grab the base data, sort by result, test for consecutive values starting from 0 going positive, find max number attained consecutively, eliminate repetitions and negatives etc.. Store the data
Job just about done.

:rolleyes:
 
Nice solution actually.

Better than mine too. I kind of went at it with a sledgehammer, should have thought through a bit better to start with - but I wanted to be sure I had everything.

I literally took all possible perms of 1, 2, 3 & 4 *, + and - and the brackets.

So each expression was made up as

( or ) or nothing followed by 1,2,3 or 4 followed by ( or ) or nothing followed by + or * or - followed by ( or ) or nothing, followed by 1,2,3 or 4 (but not the number already used followed by ( or ) or nothing etc...etc...etc....etc...

A total of 472392 calculations per number set, although some are nonsense so don't give a result, such as )1+2+3(+4 etc... then sort, unique the list, discard the negatives find the highest in the sequence then move on to 1, 2, 3 and 5 then 1, 2, 3 and 6 then 1, 2, 3 and 7

24 hours later and about 700,000,000 calculations (I initially only used numbers up to 15) I had the answer.

...but as I say, I think your solution is certainly more elegant.
 
'BurntBread' .. You didn't notice the one on any x from y (footy perms etc) in the distant past hereabouts??

This time I was saved by :-
While all your data is selected go to Edit>Paste special then check the Multiply or Add option and click OK.
All the text numbers will now be forced to convert to real numbers.

My concatenated text suddenly became live formulae !! Had forgotten that little trick !
And this was the killer help :-
Highlight the problem text cells and format them as General, or any needed formatted other than Text.

Push Ctrl+H (to display the Replace dialog) type an = (equal sign) in the Find what: box.

Type another = (equal sign) in the Replace with: box and then click the Replace All button.

Thanks to
http://www.ozgrid.com/Excel/ConvertToNumbers.htm
:D :D :D
 
Never saw the footy perms one empip, I'll search for it.

For those interested, the best set of numbers seems to be
1, 2, 5 and 6 using these you can make all numbers up to 43.

Nice puzzle eh?
 
By the way i didn't realise there was so many egg-heads who were members. :LOL: the only numbers i care/need to know relate to feet and inches :LOL:
 
hello lad

the brainboxes ...lol an you turn up hmm ...Brainzs ..lol
doing these Intelligent adventure games ..lol


how are you lad ...?

my peggy sue an her sis is out tonight down deansgate . .....
I sat at the puter with music channel blaring ,
duty free 85% rum bottle an litre coke ...

lol
that was drinking coke an not the speedball type ,lol
talking of speedball cokes frenzies .....

HOW/WHY DID Prestwich Manc secure mental hospital START holding/treating(lol) nonces , one escaped there last week , ?????

when I got sectioned after a lost pill poppin weekener in my 20s ,
they didnt have nonces in the Edenfield unit then ?
 
Sponsored Links
Back
Top