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

You are not logged in.

- Topics: Active | Unanswered

Hi Liaminati4444;

Sorry, we had to add 99 to the post before. It was actually 196,713.

But you didn't add 99 to the post before, either. ( ͡° ͜ʖ ͡°)

Your number should have been 196,812, except that Agnishom in post #1987 missed posting his number, too (he was missing bobbym, so I understand).

Catchup: 196,911.

Mine: 197,010.

Each posted number should be 99 x the post number.

Did you look at the page I gave the link to?

Although it is headed 'Percentage Change', the first part of it covers your problem completely, by giving:

1. the definition of *percentage increase*;

2. two different methods of calculating *percentage increase*;

3. one calculation example for each of the two methods.

MathsIsFun's treatment of this topic is excellent and very clear.

Thanks, Samuel, but thickhead's one, not me. I had to take the non-maths route.

I got Mathematica to work out the permutations and export them to a text file, and then copied the contents into Excel which counted the number of valid seating arrangements.

Mathematica could have done that last bit too, but I didn't know how. If bobbym was still here I'd've asked him, and he would've taught me how immediately!

Mathematica code: Export["seating.txt", Permutations[{c,c,c,c,c,r,r,r,r,r,m,m,m,m,m},{15}]]

Excel:

- Pasted the permutions list from the text file into A1, which Excel automatically populated into A1:A756756.

- Entered this formula into B1: =IF(AND(MID(A1,2,1)<>"c",MID(A1,5,1)<>"c",MID(A1,8,1)<>"c",MID(A1,11,1)<>"c",MID(A1,14,1)<>"c",MID(A1,17,1)<>"r",MID(A1,20,1)<>"r",MID(A1,23,1)<>"r",MID(A1,26,1)<>"r",MID(A1,29,1)<>"r",MID(A1,32,1)<>"m",MID(A1,35,1)<>"m",MID(A1,38,1)<>"m",MID(A1,41,1)<>"m",MID(A1,44,1)<>"m"),1,"")

- Double-clicked on the copy handle to automatically copy the formula down Column B alongside all the permutations in Column A.

- Entered this formula into C1: =SUM(B:B)

C1 output = 2252.

All quite quick, now that you clarified the problem, which shrank it to a manageable size for my method.

*EDIT: This Mathematica code will give the answer 2252 (a post on mathematica.stackexchange gave me a clue):*

`Length[DeleteCases[Permutations[{c,c,c,c,c,r,r,r,r,r,m,m,m,m,m},{15}],{___,c,___,_,_,_,_,_,_,_,_,_,_}|{_,_,_,_,_,___,r,___,_,_,_,_,_}|{_,_,_,_,_,_,_,_,_,_,___,m,___}]]`

It can be run online at Wolfram Programming Lab, if you don't have Mathematica. Just paste my code over the "2+2" code that appears in program 1 on the opening page, then press the orange/white 'Run input' arrow (or click somewhere in the code and press Shift+Enter).

Hi;

756756 permutations - 754504 constraints = 2252 different ways.

Hi Samuel;

I'd say, from the figures that are still embedded indelibly in my brain after spending so much time on your problem, that 2252 is a fair bit short of the mark.

Your puzzle, without any 'who can't sit where' constraints, has (3x5)! - ie, 1,307,674,368,000 - permutations of different seating arrangements.

Reducing the numbers in each group, I get:

(3 groups of 2)! = 720 different arrangements, of which 640 are eliminated by the seating constraint, leaving 80 valid arrangements;

(3 groups of 3)! = 362880 different arrangements, of which 350784 are eliminated by the seating constraint, leaving 12096 valid arrangements.

I got Mathematica to print the permutations, which I pasted into a text editor and did the eliminations there.

The next reduced group, that of 3 groups of 4 people, would give an even larger number of valid arrangements, and your 3 groups of 5 people puzzle would result in something much larger than the 3x4...which thickhead has probably found (not that I can confirm it).

Hi thickhead;

I've actually spent quite some hours on this, but I just don't have enough knowledge or understanding in this area to get anywhere with it. Having quit school after flunking 4th-year high school makes it well-nigh impossible for me to tackle something like this mathematically...which a problem of this size really needs.

Anyway, I ignored that and tried to solve it by reducing the OP's 5x3 group to the groups 2x3, 3x3 and 4x3, got each of the 3 groups' permutations, sifted out their incorrect seatings and obtained solutions for those groups (the 4x3 took a lot of effort!!). My plan was to play 'spot the pattern' with that info, but despite seeing lots of factorial content I just couldn't see a common factorial (or other) pattern in those groups that I could use to solve the 5x3 group.

I eventually decided that I'd spent far too much time taking the long route to nowhere, and gave up...and to make sure I didn't return to it (I find it hard to give up on something that I think I have a chance of solving, mind you!), I threw all of my work away.

Sorry, but your solution goes waaay over my head, and so I didn't comment.

Hi Zeeshan 01;

The following MIF page is a good one to help you with that: Percentage Change.

This next code takes only about one 50th of the time of the previous post's code, achieved by changing the method by which the results are printed.

Instead of printing them in 'output format' within Mathematica (which takes forever), this code prints them in text format to a file that I called "list.txt", which M automatically places into my Windows 10 'Documents' folder.

The file contents then print into M's output pane...in a blink!

The contents of the file are automatically overwritten each time the program is run, but renaming the file in the code before an evaluation will create a separate file. That only needs to be done in one location...the 'f' variable in the first line.

The results are listed in descending numerical order within each group of deducted primes - as per the OP's method - and those deducted prime groups appear in ascending order of deducted primes (see example in the hide box in the previous post).

I've included a counter that returns the total number of odd-prime trios.

The next code displays the results in ascending order:

These codes also work in the online Wolfram Programming Lab (although the output is limited to 150 lines), but not in the Mathics link that worked on my earlier code versions.

This code is nearly twice as fast as the one in my previous post.

It now counts +/- 2 instead of 1 and starts the count from an odd number, thus having to test only odd numbers for primality.

The output is for sum = 31.

The following Mathematica codes display all possible trios of odd primes for a given sum (which must be odd).

For Mathematica program, or online at Wolfram Programming Lab:

Online at Mathics, here:

You'll run into time/memory problems pretty quickly because of the exponential growth in permutation numbers. Wolfram is much quicker than Mathics and handles larger numbers better, giving the answers to sum = 1001 immediately, while Mathics times out. Wolfram failed with sum = 10001.

Hi!

Thought I'd try this on a spreadsheet (Excel)...so here is a link to a video of it in action. It basically follows the M-code method from my previous post.

I don't know any VBA, hence the spreadsheet approach...with iterations, Conditional Formatting, and a couple of macros assigned to rectangle shapes.

Enjoy the accompanying music clip! It's called *Jazz in Paris*.

I think you'll like it (the music, I mean).

If you have Mathematica, here is some code you could run that will give a range of answers depending on your input:

The program will ask you to enter:

1. the sum of 3 odd primes (which must be an odd number); and

2. the deducted (non-paired) prime.*Note: An incorrect answer to a question will result in the question being repeated. *

For sum = 31 and deducted prime = 5, the output is:

5 + 13 + 13 = 31

5 + 7 + 19 = 31

5 + 3 + 23 = 31

For sum = 31 and deducted prime = 7, the output is:

7 + 11 + 13 = 31

7 + 7 + 17 = 31

7 + 5 + 19 = 31

------------------------------------------------------------------------------------------------------

If you don't have Mathematica, here are two online options for running Mathematica code:

1. The new, free, cloud app Wolfram Programming Lab. Session times are quite short, but you can refresh, although you may need to paste the code again. Also, being a new app, it's a bit slow and unresponsive at times, and so you may need to be patient, or even to run the code again.

(a) Paste my code (above) over the '2+2' that appears in the first program, left-click anywhere in the pasted code, and press Shift+Enter to run.

(b) Enter the requested values into the popup windows, making sure to click 'OK' (not the 'Enter' key) when you've finished typing.

2. Mathics Online. There doesn't seem to be a session time limit.

(a) Paste the following code onto the page at the blinking cursor, and change the first line's pre-entered 'x' and 'a' values to suit.

(b) Left-click anywhere in the pasted code, and press Shift+Enter to run.

* There doesn't seem to be an Input-with-prompt function (unlike with Wolfram Programming Lab), but just change the 'x' and 'a' values directly in the code.*

Hi rushatiindia,

I would like to know how to calculate and express a number as the sum of three odd primes.

I can't think of a simple way of doing that, as the contents of groups of three primes are too inconsistently spaced.

The best idea I can come up with to calculate groups of three odd primes that will total a given sum is to deduct an odd prime from the sum, and then to find the remaining prime-pair by your +/- method (but I don't know how to put that into a single expression).

eg, for sum = 31 and deducted prime = 11:

31 - 11 = 20

20/2 = 10

10 - 1 = 9 and 10 + 1 = 11: False (9 isn't a prime)

10 - 2 = 8 and 10 + 2 = 12: False (8 and 12 aren't primes)

10 - 3 = 7 and 10 + 3 = 13: True (7 and 13 are primes)

That gives the answer 11 + 7 + 13 = 31.

There are 5 other answers for 31, comprising the deducted prime followed by a prime-pair that is found by your +/- method:

a) 3 + 11 + 17 = 31

b) 3 + 5 + 23 = 31

c) 5 + 13 + 13 = 31

d) 5 + 7 + 19 = 31

e) 7 + 7 + 17 = 31

Some questions:

1. Are all five of my answers valid for your purposes?

2. What is the highest sum you want this for?

3. Are duplicate primes allowed? eg, as in 7 + 7 + 17 = 31.

4. Does the fact that the sum of 3 odd primes is *always* an odd number lead to any problems?

5. How do you determine primality? eg, from a list of primes.

6. Is one answer better than another? eg, is 7 + 11 + 13 = 31 better than 3 + 5 + 23 = 31?

7. How do we choose the deducted prime? eg, the next prime higher than sum/3. The choice will determine the range of answers.

8. Do you want to do this just by hand/calculator/primes list?

(a) If not, do you have access to Mathematica? (see next post)

Hi all;

Sorry, thickhead, but I haven't looked at your method yet as I'm still struggling with my thoughts on this.

Anyway, I made another model that was much more accurate than before, and couldn't get it to agree with the straight-line method of my previous posts.

Using measurements from post #6 (pipe D=29, tape W=18 ), my model was giving an approx tape angle of 79°, so I had to rethink (sorry, Bob!)

I'd overlooked the fact that distance travelled governs the elevation angle, which is why my straight-line method (really a short cut) gave me the steeper angle (by about 7°).

I now have the following formula, for which I've chosen the upward angle from the side because it saves marking a line across if there's no pipe base to work from:

*Edit: Hmmm...looking at thickhead's solution, I think I have a small error. Getting there, though... *

Ah, yes...I inadvertently had GB as the tape width. This should be the correct formula:

Hi Bob,

In my drawing in post #2, A and B are the outer points of the straight line AB that is both the diameter and the front curve of the vertical pipe. In 3-D, that dual straight-line property only occurs when AB is viewed along a plane that extends horizontally forward from AB...which is how the line is viewed in my 2-D model.

Similarly, AG, with G being directly above B, has that same dual straight-line property.

In such along-the-plane viewing, the 2-D model can be used, thus avoiding having to consider the curved nature of the pipe's surface.

That's how I see it.

Hi Bob,

Yes, that is an extreme case, and one that is only a solution if the tape width is identical to the pipe circumference and the tape wraps widthwise around the pipe. It's probably not a valid illustration to use here, because all other solutions come from the tape wrapping lengthwise, in spiral fashion, around the pipe.

Another observation is that angle GAH cannot be less than 45°, which is shown on my video. The only exception to the minimum angle is that extreme case, where it is zero.

I still reckon the curved surface thing is a big, fat, red herring!

Btw, having seen some of your diagrams and explanations in geometry posts helped form the 2-D idea for me here.

You can see I'm fighting tooth and nail for my position: I just can't bear to think that my video may have missed the mark!

Hi Bob,

We only need to do 2-D straight-line cross-section measuring here, with any lines viewed from a point perpendicular to the front pipe face as if that face were flat.

If I cut through the pipe with my dropsaw, the result would be a straight-line cut, irrespective of whether I'd cut perpendicular to the pipe's sides (for the diameter), or cut parallel to the angled tape.

I think that straight-line measurements are sound for this problem, and that the presence of the curved surface is only an optical herring.

Of course, methods of calculating the length of tape needed to cover the pipe to a given height will differ between a flat surface and one that is curved.

Hi Bob,

I think I get your drift, but can't visualise it too well.

So...I got me a bit of round pipe and some duct tape, my vernier calipers and a compass, and did a prac test.

Pipe diameter = 29mm

Tape width = 18mm

I placed my compass at 72° to the side of the tube and drew a line, along which I then laid the top edge of the tape.

And...it worked!

Hi iamaditya,

I didn't mean anything by it. That was just a bit of wordplay.

Thanks, davidtrinh.

I did that in Geogebra, and had fun putting it together.

And I learnt some things along the way, too.

'Uncertainty' is absolute...of *that* I am absolutely certain, I think.

Hi Vietnamese, and welcome to the forum!

I found a trig solution...see image below, which hopefully is clear enough. If not, just let me know and I'll try to explain.

I've shown a 3.2-wide tape starting at bottom left of the front visible pipe face, moving upwards to the right (as indicated by the arrows) and wrapping around the vertical pipe 1.5 times. The broken lines show the location of the tape behind the visible pipe front.

The figures I've used are just examples, so enter your own into the formula to suit.

Formula to find angle GAH:

This next formula is shorter and will give exactly the same answer, but I think the proof might be a bit longer:

To ensure that the tape will cover the entire vertical pipe face, the top left corner of the tape must start at or below the bottom of the pipe.

Here is a video of an animation displaying the effect of different tape widths.

Roman numerals (C/C/I):

ONE:

400:

169,196,961:

9+0:

9-8:

10-9:

81-0:

6^0, 8^0, 9^0, 10^0:

6/6:

8/8:

9/9:

Hi;

Three green matches are relocated to form a '4' in front of the red '0', and one green match is removed.

This forms the number 400, which is a square (20 x 20).

Inspired by Bob's idea of nine being a square number.

Hi Bobby;

Everybody has a twin somewhere in the world

Very limiting, that is.

Marsling and earthling twins, first revealed and announced here on MIF!