Sunday, February 28, 2010

Feeling No Pain

Zaux went to the guitar store to buy three items.All three items cost more than $0.99 and less than $9.99.He wanted to find the total cost before he had to pay for them,so he adds them up.Since Zaux took more pain meds today than he should have(on purpose) he multiplys instead of adds.However,he still gets the correct answer.

Given that the total number of cents he spent ended in 7,find the cost of each item.

(there are two solutions)

13 Comments:

Blogger Karl Sharman said...

I've got
$1, $2.11 and $3.11 = $6.18
$1, $2.09 and $3.03 = $6.12

Process of elimination - which numbers, ending in 7 between 1 cent and 99 cents were not primes - 27 and 77 - and initially assuming at least one purchase value would be $1, worked it out from there.

March 1, 2010 3:51 AM  
Blogger Karl Sharman said...

Then I realised I'd made a mistake when verifying the figures and have started again.

March 1, 2010 3:53 AM  
Blogger Chris said...

This post has been removed by the author.

March 1, 2010 4:59 AM  
Blogger Chris said...

$1.00, $1.32 and $7.25 => $9.57
$1.25, $1.62 and $2.80 => $5.67
Method: brute force :(

March 1, 2010 5:38 AM  
Blogger Chris said...

This post has been removed by the author.

March 1, 2010 5:39 AM  
Blogger Chris said...

... Zaux multiplied those in his head!!!

March 1, 2010 8:56 AM  
Blogger Chris said...

This post has been removed by the author.

March 1, 2010 9:02 AM  
Blogger Zaux said...

mmmmmm ... the pain meds must have subdued my craving for musical goodies, because I don't ever remember a trip to the music store where I parted with less than $9.99

March 1, 2010 9:24 AM  
Blogger Zaux said...

wow ... I agree with Chris ... I multiplied those in my head?

March 1, 2010 9:58 AM  
Blogger Zaux said...

This post has been removed by the author.

March 1, 2010 9:59 AM  
Blogger Chris said...

Here's some faster code, I've deleted the first crude version

Sub sAbc()
'trying to find a+b+c=abc where 9.99 >a,b,c >0.99
'and a*b*c = a+b+c and 100(a+b+c) mod 10 = 7
  Dim a, b, c, d As Integer
  
  'optimized for speed
  For a = 99 To 999
    For b = a To 999
      'ensure that only generate sums which = 7 mod 10
      d = b + (17 - ((a + 2 * b) Mod 10)) Mod 10
      For c = d To 999 Step 10
        If a * b * c = 10000 * (a + b + c) Then
          Debug.Print "a, b, c, a+b+c, a*b*c =", _
            a/100, b/100, c/100,(a+b+c)/100,a*b*c/1000000
        End If
      Next c
    Next b
  Next a
  Debug.Print "finished"
End Sub

March 1, 2010 10:21 AM  
Blogger Knightmare said...

yeah...you got it Chris
your prize is a $0.27 guitar pick

March 1, 2010 8:06 PM  
Blogger Chris said...

Can I have that at 10%/year for the rest of my life?

March 2, 2010 4:27 AM  

Post a Comment

Links to this post:

Create a Link

<< Home