Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#301 2010-06-09 05:04:27

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: What do you think?

Hi Bobby,

Yes, that is fast. I like the fact that it lists the permutations, which I haven't been able to do in Excel (I have to enter each permutation manually - but the calculation results are instantaneous).

Why does it include powers of 2? It appears to me that no power or multiple of 2 yields a solution. I don't know the logical argument for excluding 2, though.

I tried to change the code to solve for 3543075, but I must have done something wrong as it only prints about half of the total number of answers (according to LB). I haven't yet understood what your code's doing, so I'm only guessing with my code changes.

Here's what I'm up to. Can you see where I've gone wrong?

FactorInteger[2*3543075]

foo[l_] := Times @@ l;

The next line need adjustment for each new problem;
two = Union[
  foo /@ Permutations[{1, 3, 3^2, 3^3, 5, 5^2, 29, 181}, {4}]]

ans = Solve[{(b + 1) == f, (b + 2 m) == 2*3543075/f}, {b, m}] /. 
  f -> two

Select[MapThread[List, {ans[[1, 2]] // Last, ans[[1, 1]] // Last}], 
 IntegerQ[First[#]] == True && First[#] >= 0 &]

Last edited by phrontister (2010-06-09 11:32:39)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#302 2010-06-09 07:55:45

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi phrontister;

Just generally saying, you would have to make some adjustments for each new number based on it's unique factorization.

I haven't given the 2's a lot of thought, I wanted to be on the safe side and not miss any solutions.

I can only come up with 48 solutions ( change {4} to 4 in Permutations and put the 2 back between 1 and 3 ) to your new problem. What solutions do you get? I have tried to write the M7 code to mirror the way the problem is solved in the book. It was solved for 1000 a much smaller number. And one with less factors. Also my understanding of the book solution may not be complete. Probably needs some bells and whistles.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#303 2010-06-09 12:06:52

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: What do you think?

Hi Bobby,

I eliminated 2 because I couldn't get Excel to automatically list all permutations, and typing in permutations including 2 would be tedious and unnecessary. In LB I'd already seen from the dozen or so test cases that included powers or multiples of 2 that 2 was out. No logic to that discovery, though...I can't prove it.

Your changes worked, and I also got 48 solutions in M7. However, it lists 3543075 as a solution...which of course it isn't. LB only lists

Yes...the code may be missing a bell or a whistle.

This is my LB code. Slooooow, but it gets there...and it checks all the options along the way. No doubt it can be improved...probably by using permutations somehow.

    for a = 1 to 1771538
        y = 0
        x = a
        do
        y = y + x
        if y = 3543075 then
            print a
        end if
        x = x + 1
        loop while y < 3543076
    next a
    print "End"
    end

Last edited by phrontister (2010-06-09 12:11:06)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#304 2010-06-09 13:04:47

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi phrontister;

Change the last line to this:

Select[MapThread[List,{ans[[1,2]]//Last,ans[[1,1]]//Last}],IntegerQ[First[#]]==True && First[#]>=0 && Last[#]!=0&]

That LB code can implemented in 7 too. Just being mindful of syntax of course. The advantage of using 7 is that once you understand the math way, it is easy to just translate it into 7. With all the speed advantages.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#305 2010-06-10 02:32:17

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: What do you think?

Works fine now thanks Bobby.

...once you understand the math way, it is easy to just translate it into 7.

That would take me a lifetime, given all the spare time I haven't got. Might have to wait until my retirement in 40 years time (at age 67) before I can devote enough energies towards 7 to get a better grip on it. You can help me some more then.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#306 2010-06-10 03:05:50

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

That would take me a lifetime

It takes everyone a lifetime, some people a little longer. Have you seen the wolfram demonstrations page?

http://demonstrations.wolfram.com/

You can download the scource code and run the ones that interest you. There, you will get an idea of what 7 is capable of.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#307 2010-06-16 21:25:17

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Calculate the successive discount of 10%, 20% and 25% on some marked price p.

A says) Can't be done, math doesn't work, just read my paper on cellular mitosis.

B says) Of course math works, you do it like this: I am hiding the solution cause I hate A.

Obi Wan says) Don't give in to hate B, that leads to the dark side.

C says) I don't know I tried your formula on a pair of pants at sears and it didn't work. The pants were too small.

A says) See it's all here, cellular mitosis baby.

D says) That'll work, but isn't there something better?

B says) Sure is!

Can you find B's improved solution?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#308 2010-06-16 22:11:33

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: What do you think?

Hi Bobby,

I'd do it like this

Re cellular mitosis, I got as far as this in Wikipedia and gave up: "Mitosis is the process by which a eukaryotic cell separates the chromosomes in its cell nucleus into two identical sets in two nuclei."

A's paper on it would have to be many smidgens easier on the eyes than that to hold my interest.

Last edited by phrontister (2010-06-16 22:20:13)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#309 2010-06-16 22:30:15

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi phrontister;

B's super method is this:

Is that what you have done?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#310 2010-06-16 22:48:54

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: What do you think?

Yes, that's what I did.

There's a bit of mental arithmetic that got it to that point, but which I didn't show.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#311 2010-06-16 23:07:55

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Excellent work then !

Don't worry about A, people like him really squash my zucchini.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#312 2010-06-22 12:38:38

Fruityloop
Member
Registered: 2009-05-18
Posts: 143

Re: What do you think?

Two die are thrown at once. The sample space is 2,3,4,5,6,7,8,9,10,11,12. How many times must this be done on average to get all eleven numbers?

I just got a new computer.  But, I wrote a C++ program on my old computer to solve this and I got an answer of about


My compiler dates from 1992!  I'm going to have to download a newer one from the Internet.
I can't see an easy way of getting the answer without computer help.

Last edited by Fruityloop (2010-06-22 12:40:09)

Offline

#313 2010-06-22 15:50:49

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi Fruityloop;

All I can  say right now, is that seems close to the right answer. So good work!
You are correct in saying if might need computer assistance. All the math ideas I am
trying are really hard work.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#314 2010-06-22 22:36:40

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi;

Problem:

7 7 7 7 7 7 7 = 14 You must use each of + - / * once and only once.

A says) Can't be done, I need to concantenate those 7's
B says) That is implied, so it can be done.
C says) I am forced to agree with whatever D is going to say.
D says) I think it has lots of solutions.

Find the solution if you disagree with A:


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#315 2010-06-24 22:01:23

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Anakin wrote:

A tool shed, 250 cm high and 100 cm deep, is built against a wall. Calculate the shortest ladder that can reach from the ground, over the shed, and to the wall behind.

A says) This guy solved it using Calculus, that is the right way. http://www.mathisfunforum.com/viewtopic … 82#p145382
post #2. That guy is good!
B says) He is okay but he is too mechanical. There is a nice computer way to solve that, No Calculus allowed.
C says) I agree with A.
D says) You don't need a computer either, just a large sandy beach.
E says) Man, I love the beach.

Who is right and why?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#316 2010-06-29 17:37:50

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

A box of max.

B has 10 cards and on them he writes 10 positive numbers. He looks at the cards and says , if you sort them in descending order
a > b > c > d > e > f > g > h > i > j , then b + c > a and d + e + f > b + c > a and j + i + h + g > d + e + f > b + c > a. then there is the a smallest a and a largest j.

A says) Impossible.
B says) No it isn't.
C says) I have the answer.
D says) But A is never wrong.
E says) I agree with D.

Who is right?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#317 2010-07-03 00:00:39

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

So easy, it hurts to write it!

When can you draw a tangent from a point to a parabola?

A says) There is always a tangent from any point to any parabola! I have a 29 page proof of this.
B says) As usual A has gone off on a tangent. You can't draw a tangent from just any point to a given parabola.
C says) It is hard to believe but A is wrong.
D says) I agree with A, I have been drawing paraboli all day and I can't find a single point that you can't draw a tangent from.
E says) I agree with B, I am sure you can find an example of a point and a parabola that you cant draw a tangent  to the parabola and through the point.

Who is right and can you find the conditions when you can and can't?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#318 2010-07-14 20:20:26

rga1015
Member
Registered: 2010-07-14
Posts: 1

Re: What do you think?

hi... pls show the complete solution.... what is the derivative of f(x)=square root of (4x^2-1)

Offline

#319 2010-07-14 20:26:27

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi rga1015;

Use the chain rule.

Say

Now just plug into A)

Welcome to the forum!


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#320 2010-07-15 16:18:26

jimmyR
Member
Registered: 2009-05-29
Posts: 143

Re: What do you think?

Hi bobbym;

Last edited by jimmyR (2010-07-15 16:20:14)

Offline

#321 2010-07-15 16:21:50

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi jimmyR;

Thanks, I know that one!


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#322 2010-07-26 03:01:14

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: What do you think?

Hi Bobby,

Re your post #285:

Do you think you can come up with a solution method using 7? A method that LB couldn't do?

Finally got around to looking at this. No time! sad

I guess you mean using a 'permutations' function (which LB doesn't have in-built). I used the 7 formula you gave me and solved it like

My LB code only takes about 4.5 seconds, but I cheated by whittling down the options with some logic to the point where LB was left with very little to do.

my code.

I also remembered a problem that a LB forum member helped solve for me about a year ago. It contained a permutations function, which I've adapted for this puzzle. Speed is about 10x faster than my old full code, but 7 is about 10x faster again. smile

the code.

My code is very wordy, but I like to get reasonable output presentation and also to weed out non-solutions.

Soon I'm going to reinstall my old 2.7GHz dual core processor as it's generally faster than the 3.2GHz quad I had installed recently. About the only benefit I've seen with the quad is in video rendering (my reason for getting it), which I did a lot of for a few weeks after my last holiday...but the general slow-down (especially with Excel, LB & 7, where the dual core is 3x faster!) is annoying. I should have researched it better before buying it. sad

Last edited by phrontister (2010-07-26 03:38:32)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#323 2010-07-26 03:54:49

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi phrontister;

Where the heck have you been? That is nasty good code!

Have you got M set to utilize the extra processors?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#324 2010-07-26 11:36:57

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: What do you think?

Hi Bobby,

The death of a 90-year-old close member of the family has made life even more hectic than it already was, and I just can't keep up with everything that needs doing. I've had to cut down my forum participation (not just MIF) to cope.

Thanks for that optimizing hint. It worked, and processing time for the puzzle on M is down to about a fifth of previous. 3 cores ran at >90% for the whole process, while the other ran at about 80%. It warmed up the cpu by a couple of degrees...so I can save on wood for the fire!

EDIT: The Timing function doesn't work properly now that I changed the code to include Parallelize, and in fact the processing time is only down to half of what it was before parallel optimization. The timer always worked well before. sad

my new code.

I think I'll still go ahead with the cpu swap, though, because most of the old programs I run can't be optimized for quad and I don't want to keep the quad just for the couple that can be optimized. Those old programs, and my computer generally too, all run slower now, and until I upgrade most of them (but that's $$$!) - and provided they take advantage of parallel processing - I'll be better off with dual core. I've read up about it, and that seems to be the consensus.

Last edited by phrontister (2010-07-27 10:51:26)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#325 2010-07-26 16:39:06

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi phrontister;

Sorry about your loss. I lost my mom in november, so I know what you are going through. Helps to work, particularly on problems that have nothing to do with everyday existence.

Good use of the Parallelize command. I think their is a switch in M in the options to make sure that you use your multiple cores more efficiently. Anyway, you might be right to switch back.

Again, I offer my condolences to you, hope you recover quickly.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

Board footer

Powered by FluxBB