Math Is Fun Forum

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

You are not logged in.

#1 2017-05-29 16:40:33

rushatiindia
Member
Registered: 2017-05-29
Posts: 2

How to calculate and express a number as the sum of three odd primes?

In case of to express a number as the sum of two odd primes, we divide the number by 2 and we get two numbers.  Then we add 1 with a derived number and minus 1 from another derived number. Such as:

24

24 / 2 = 12

12 + 12 = 24

(12+1) + (12-1) = 24

13 + 11 = 24.

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

Offline

#2 2017-05-29 19:33:40

iamaditya
Member
From: Planet Mars
Registered: 2016-11-15
Posts: 821

Re: How to calculate and express a number as the sum of three odd primes?

In case of to express a number as the sum of two odd primes, we divide the number by 2 and we get two numbers.  Then we add 1 with a derived number and minus 1 from another derived number.

This method doesn't always work, for e.g.54,40 and so on.


Practice makes a man perfect.
There is no substitute to hard work
All of us do not have equal talents but everybody has equal oppurtunities to build their talents.-APJ Abdul Kalam

Offline

#3 2017-05-29 22:39:34

rushatiindia
Member
Registered: 2017-05-29
Posts: 2

Re: How to calculate and express a number as the sum of three odd primes?

I understand. But there is a process that we could follow till we get answer.
In case of 40 the following may be follwed:
40
40/2
20 + 20 = 40
(20-1) + (20+1) = 40
19 + 21  = 40 [21 is not Odd Prime Number]
In that case I'll again +/- 2
(19-2) + (21+2) = 40
17 + 23 = 40.

I would like to know where any such process to find three Odd Prime.

Thank you.

Offline

#4 2017-06-03 01:33:33

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

Re: How to calculate and express a number as the sum of three odd primes?

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)

Last edited by phrontister (2017-06-07 23:59:01)


"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

#5 2017-06-04 01:08:02

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

Re: How to calculate and express a number as the sum of three odd primes?

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. 

Last edited by phrontister (2017-06-11 13:13:48)


"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

#6 2017-06-07 00:08:34

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

Re: How to calculate and express a number as the sum of three odd primes?

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). smile

Last edited by phrontister (2017-06-07 19:31:50)


"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

#7 2017-06-07 18:39:37

thickhead
Member
Registered: 2016-04-16
Posts: 1,086

Re: How to calculate and express a number as the sum of three odd primes?

I do not know how you express an odd number as sum of 2 odd primes.Well. For 3 numbers you choose a prime ,say 3 and subtract. The result you can express as sum of 2 primes by your method.


{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}
(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha
{Gods rejoice at those places where ladies are respected.}

Offline

#8 2017-06-08 04:15:21

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

Re: How to calculate and express a number as the sum of three odd primes?

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.

Last edited by phrontister (2017-06-11 13:15:29)


"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

#9 2017-06-08 13:46:57

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

Re: How to calculate and express a number as the sum of three odd primes?

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.

Last edited by phrontister (2017-06-11 13:16:35)


"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

#10 2017-06-11 12:04:08

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

Re: How to calculate and express a number as the sum of three odd primes?

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! smile

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.

Last edited by phrontister (2017-06-13 00:04:41)


"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

Board footer

Powered by FluxBB