Math problems

Everything not related to Prince of Persia should be discussed here.
User avatar
Zaknafein
Sheikh
Sheikh
Posts: 48
Joined: May 1st, 2014, 11:40 pm
Location: Menorca

Re: Math problems

Post by Zaknafein »

Coco wrote:Now Im trying to figure out a way to sum all even (and only even) numbers via some formula, even if input is odd number. So if input is 7 for example the output should be 2+4+6=12. If input is 6,the result should be the same.
You can try to solve 2 + 4 + 6 + 8 + ... + 2n with the knowledge you already have about 1+2+...+n.

There is a hint:
Spoiler: show
1+2+ 4 + ...+n = S ---> 2 + 4 + 6 + ... + 2n = 2*1 + 2*2 + 2*3 + ... + 2*n = 2(1 + 2 + 3 + ... + n) = 2S
Coco wrote:Now Im trying to figure out a way to sum all even (and only even) numbers via some formula, even if input is odd number.
You can extend the previous solution to define your f(N), distinguishing if N is odd or even.
Coco wrote:Ratios between sums of even and odd numbers, their progression
You can define g(N) = 1 + 3 + ... + N, if N is odd. cause you have f(N) + g(N) = S, and you know what is g and S.
Same way defining g(N), if N is even.

Once you have g, you can define h(N) = f(N) / g(N), function of ratios.

You can also define ak = h(k), for k=1,2,3,... bk = f(k) - g(k), for k=1,2,3,...
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Math problems

Post by David »

Norbert wrote:

Code: Select all

         fResult = ((float)iNumber / (float)iDivide);
         if (IsInt (fResult))
Um, you could use the % (modulo) operator instead...

Anyway, writing a program for this seems to be overkill. :)
User avatar
Coco
Sultan
Sultan
Posts: 130
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Post by Coco »

@Zaknafein

Are we still talking mathematical way? Program should be easy.
There is a hint:
I can be dumb sometimes... :cry: Is it:

Code: Select all

2n*(n+1)/2   =>    n(n+1)      ?
Also, if I multiply entire sequence by 2, I think the my nth N should then be reduced for half its size, and that can be a problem if its odd number.

As for ratios. I've no idea how to calculate them based on N. Although I know how they progress, I don't know how to put that on paper. Here is it:

Lets take a look at sequence part from 2 to 8:
Value of N even/odd ratio
2 2/1
3 1/2
4 3/2
5 2/3
6 4/3
7 3/4
8 5/4


What I've noticed is that ratio gets reciprocal value, then for next number, flip it again and add 1 both to numerator and denominator. One ore interesting thing is that with every next number (lets take evens for now, but it applies to both) nominator gets (-1) value of that number. Example:

4 ----- 3/2
Notice number 3 in nominator 4-3=1

6 ----- 4/3
again 6-4=2

8 ----- 5/4
and again 8-5=3

But I've no Idea how to explain this mathematically

PS
I just googled Menorca :shock:
User avatar
Coco
Sultan
Sultan
Posts: 130
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Post by Coco »

Norbert had spoken:
"even for very simple programming tasks I often look up things."
So is it advisable to learn programming that way? I'm having trouble just to write a function for sorting and inversing simple number lists. In python, where syntax couldn't be possibly easier :!:
Sure there are sort() functions, and I've found the work behind it, but writing it myself...well... I have a vague idea how to do it, but I just can't complete it.
User avatar
Zaknafein
Sheikh
Sheikh
Posts: 48
Joined: May 1st, 2014, 11:40 pm
Location: Menorca

Re: Math problems

Post by Zaknafein »

Coco wrote:Are we still talking mathematical way? Program should be easy.
Yep, but sometimes you can't prove a property about an infinite set like integers.
Coco wrote:2n*(n+1)/2   =>    n(n+1)      ?
You are right. You can prove also that 1+3+5+...+(2n-1)=n^2.
Spoiler: show
1+3+5+...+(2n-1) = (1+0)+(2+1)+(3+2)+...+( n + (n-1) ) = (1+2+3+...+n) + (0+1+2+...+(n-1) ) = [n(n+1)/2] + [(n-1)n/2] = (n^2 + n + n^2 - n)
/ 2 = (2n^2)/2 = n^2
Coco wrote:Notice number 3 in nominator 4-3=1
I think you mean that 2n-[Nominatorn] = n-1.

You can simplyfy (2+4+...(2n))/(1+3+...+(2n-1)), simplifying [n(n+1)] / [n^2] = (n+1)/n.

n+1 have no prime factor common with n (it doens't exist any prime p that divides (n+1) and n).

Finally, (n+1) is the simplest nominator, and the difference is (2n)-(n+1)=n-1.
Coco wrote:I just googled Menorca
You have to travel to Menorca at least 1 time
:cool:
User avatar
Zaknafein
Sheikh
Sheikh
Posts: 48
Joined: May 1st, 2014, 11:40 pm
Location: Menorca

Re: Math problems

Post by Zaknafein »

By the way, is there any way to use Latex here?
User avatar
Coco
Sultan
Sultan
Posts: 130
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Post by Coco »

The nominators (and denominators) are behaving almost as an integer sequence. But they are getting a step behind with each step the number gets bigger. Between 2,4,6... the nominators of ratios are 2,3,4. A more interesting things are denominators in ratios. Check them out. Starting from number 2 they go 1,2,2 ,3,3,4,4 :shock: (just saw that pattern now)
I dont think latex can be used here, but Norbert certainly knows more about that.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Math problems

Post by Norbert »

Zaknafein wrote:By the way, is there any way to use Latex here?
Well, the official LaTeX forum (latex.org/forum) also uses the phpBB forum software, and they use JavaScript code to present LaTeX content in new browser tabs using Overleaf. Example link in a post here. But unless you expect to use lots of LaTeX on this forum, it might be easier (for the forum admin; currently Falcury) if forum users use a pastebin for mathematicians, such as texpaste.com. Combined with pasting the code on this forum inside...

Code: Select all

[spoiler][code]...
[/spoiler][/code]
...just in case the pastebin used shuts down.
User avatar
Zaknafein
Sheikh
Sheikh
Posts: 48
Joined: May 1st, 2014, 11:40 pm
Location: Menorca

Re: Math problems

Post by Zaknafein »

I tried to use pastebin to write the following problem, with

Code: Select all

[spoiler][code]$$ equation $$
[/spoiler][/code] using also texpaste.com, but it doesn't work. I'll try to use Overleaf to write non elemental math problems. At the moment, there is a problem:

Let Susan and Paul two players.
Let 1<a<=b<100 integers.

Susan knows S=a+b.

Paul knows P=ab.

They also know the initial situation.

They have that conversation (they tell the truth and are intelligent enough):

P: I don't know a and b values.

S: I knew that you couldn't know that.

P: Now, I know a and b values.

S: I also know the values of a and b.


The problem is to find a and b. Good luck! ;)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Math problems

Post by Norbert »

Zaknafein wrote:I tried to use pastebin to write the following problem, with

Code: Select all

[spoiler][code]$$ equation $$
[/spoiler][/code] using also texpaste.com, but it doesn't work.
You should be able to use something like
$$ E=mc^2 $$
in texpaste.com without problems.

Link:
http://www.texpaste.com/n/bvbkcxq2

Backup:
Spoiler: show

Code: Select all

$$ E=mc^2 $$
User avatar
Coco
Sultan
Sultan
Posts: 130
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Post by Coco »

The only thing I can think of is that A and B can have range:
A = [2, 49]
B = [49, 97]
depending on the other number

EDIT:
My bad. B can also range from [2,97] if A=2
User avatar
Coco
Sultan
Sultan
Posts: 130
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Post by Coco »

Actually, scratch all that. I wrote on paper that a+b<=100 xD
User avatar
Zaknafein
Sheikh
Sheikh
Posts: 48
Joined: May 1st, 2014, 11:40 pm
Location: Menorca

Re: Math problems

Post by Zaknafein »

Coco wrote:The only thing I can think of is that A and B can have range:
A = [2, 49]
B = [49, 97]
I think you are wrong, because A=3, B=53 is not a solution.

S=3+53=56.
P=3*53=159.

P is product of 2 prime numbers. Then, this is the only way to factorize 159. Paul should know the solution of (A,B), but he doesn't.

I think you need to make a program to solve it
User avatar
Zaknafein
Sheikh
Sheikh
Posts: 48
Joined: May 1st, 2014, 11:40 pm
Location: Menorca

Re: Math problems

Post by Zaknafein »

Here is another similar problem:
https://www.teamten.com/lawrence/puzzles/daughters.html

It can give you a hint about how to solve the previous problem.
User avatar
Coco
Sultan
Sultan
Posts: 130
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Post by Coco »

36= 2*3*6 I haven't checked the solution.
So only thing I know is that:
A>1
A <= B
and
B<100
?
A and B are integers.
I don't really have any restrictions here. I've no idea how much is a+b or a*b, nor is there a limit of their sum/product. Doesn't this mean I can just pick any number for their values between 2 and 99 ofcourse?
Post Reply