Help me convert this into formula

Status
Not open for further replies.

smslca

Member level 1
Joined
Sep 9, 2007
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,656
please convert the below(P) into formula using (m), or give an algorithm using (m) to get (P)

m=2, P=0
m=3, P=3
m=4, P=3+5
m=5, P=3+5+5
m=6, P=3+5+5+7
m=7, P=3+5+5+7+9
m=8, P=3+5+5+7+9+9
m=9, P=3+5+5+7+9+9+11
m=10, P=3+5+5+7+9+9+11+13
m=11, P=3+5+5+7+9+9+11+13+13
m=12, P=3+5+5+7+9+9+11+13+13+15
m=13, P=3+5+5+7+9+9+11+13+13+15+17
m=14, P=3+5+5+7+9+9+11+13+13+15+17+17
and so on

I did not understand how to evaluate it into a formula
 

Re: convert into formula

Let n = [m/3] ; [] mean integer part
and k = m mod 3 ; mod mean modulus (remainder of the integer divide m/3)

That is:
m --> n , k
3 --> 1, 0
4 --> 1, 1
5 --> 1, 2
6 --> 2, 0
7 --> 2, 1
8 --> 2, 2
9 --> 3, 0
...............


Then P(n,k) = n*(6*n-1) + k*(4*n+1) - 2
 

convert into formula

thanks for the replies
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…