Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
making non integer values sum to n

Subject: making non integer values sum to n

From: Tim Smith

Date: 20 Nov, 2008 23:00:13

Message: 1 of 4

Sorry for previous post it was slightly incorrect:
Can anyone help me with this problem

where n is divisible by 4 and n,a,b are any real integers such that a+b<(n/2)

i need to create a statement such that:

integer((n-a-b)/4) + a + integer((n-a-b)/2) + b + integer((n-a-b)/2) = n

can anyone help?

Subject: making non integer values sum to n

From: John D'Errico

Date: 21 Nov, 2008 00:19:02

Message: 2 of 4

Tim Smith <imaccormick@gmail.com> wrote in message <17829314.1227222052740.JavaMail.jakarta@nitrogen.mathforum.org>...
> Sorry for previous post it was slightly incorrect:
> Can anyone help me with this problem
>
> where n is divisible by 4 and n,a,b are any real integers such that a+b<(n/2)
>
> i need to create a statement such that:
>
> integer((n-a-b)/4) + a + integer((n-a-b)/2) + b + integer((n-a-b)/2) = n
>
> can anyone help?


What do you mean by "create a statement"?

What are you asking for? Do you need to find
values of a and b such that this expression
essentially evaluates as true? If so, then why
not say that?

Do you need to find a single such set of numbers?
All sets of numbers? Something else? Explain your
problem.

John

Subject: making non integer values sum to n

From: ImageAnalyst

Date: 21 Nov, 2008 01:28:19

Message: 3 of 4

On Nov 20, 6:00=A0pm, Tim Smith <imaccorm...@gmail.com> wrote:
> Sorry for previous post it was slightly incorrect:
> Can anyone help me with this problem
>
> where n is divisible by 4 and n,a,b are any real integers such that a+b<(=
n/2)
>
> i need to create a statement such that:
>
> integer((n-a-b)/4) + a + integer((n-a-b)/2) + b + integer((n-a-b)/2) =3D =
n
>
> can anyone help?

------------------------------------------------------------
Why not just do a brute force iteration over all possible combinations
of integers n, a,and b? I'm sure you'll get a whole boat load of
numbers - more than you could possibly want. You could probably get
millions of sets in a few seconds. Have at it.

Subject: making non integer values sum to n

From: Roger Stafford

Date: 21 Nov, 2008 04:53:02

Message: 4 of 4

Tim Smith <imaccormick@gmail.com> wrote in message <17829314.1227222052740.JavaMail.jakarta@nitrogen.mathforum.org>...
> Sorry for previous post it was slightly incorrect:
> Can anyone help me with this problem
>
> where n is divisible by 4 and n,a,b are any real integers such that a+b<(n/2)
>
> i need to create a statement such that:
>
> integer((n-a-b)/4) + a + integer((n-a-b)/2) + b + integer((n-a-b)/2) = n
>
> can anyone help?

  Your query is marred by a lack of clarity, Tim. Besides the unclear phrase "create a statement" which John has pointed out, you don't make it clear what you mean by "integer" in "integer((n-a-b)/4)". You also speak of "real integers". What else can an integer be but real?

  Let's assume that by "integer(x)" you mean the "integer part of" as in Matlab's 'fix' function. Substituting p for n-a-b in your equation gives the equivalent equation

 fix(p/4) + 2*fix(p/2) = p

  It is easy to show that there can be only seven possible integer solutions for p here: p = -7, -5, -2, 0, 2, 5, and 7. However, for each of these there will be infinitely many possible combinations of n, a, and b that would satisfy all your conditions. For example, n = 12 and any pair of integers, a and b whose sum is 5, of which there are infinitely many, would be solutions.

  In my mind this raises the question as to whether you have stated your problem correctly.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us