# Nth term for integers resulting from an algorithm...

• Jan 17th 2007, 02:20 AM
anthmoo
Nth term for integers resulting from an algorithm...
That's the best title i could do that's descriptive...

Here is the algorithm..

Step 1: Input a positive integer n
Step 2: Draw a graph consisting of n vertices and no arcs.
Step 3: Create a new vertex and join it directly to every vertex of order 0.
Step 4: Create a new vertex and join it directly to every vertex of odd order.
Step 5: Stop.

I put in the integers 1 to 5 in the algorithm and got the results of the number of arcs as...

n=1, a=3
n=2, a=4
n=3, a=7
n=4, a=8
n=5, a=11

State how many arcs are in the graphs that results when the algorithm is applied to a set of n vertices.

So basically the question is asking what is the nth term of these numbers:

3, 4, 7, 8, 11

Please could someone help me understand the method of how they got the nth term?

Thanks guys!
• Jan 17th 2007, 03:38 AM
CaptainBlack
Quote:

Originally Posted by anthmoo
That's the best title i could do that's descriptive...

Here is the algorithm..

Step 1: Input a positive integer n
Step 2: Draw a graph consisting of n vertices and no arcs.
Step 3: Create a new vertex and join it directly to every vertex of order 0.
Step 4: Create a new vertex and join it directly to every vertex of odd order.
Step 5: Stop.

I put in the integers 1 to 5 in the algorithm and got the results of the number of arcs as...

n=1, a=3
n=2, a=4
n=3, a=7
n=4, a=8
n=5, a=11

State how many arcs are in the graphs that results when the algorithm is applied to a set of n vertices.

So basically the question is asking what is the nth term of these numbers:

3, 4, 7, 8, 11

Please could someone help me understand the method of how they got the nth term?

Thanks guys!

Suppose n is odd.

at step 2 there are n verts of order 0
at step 3 there is 1 vert of order n, and n or order 1
at step 4 there are 2 verts of order n+1, and n of order 2.

Total or orders at step 5=2(n+1)+2n=4n+2

Number of arcs is half the sum of the orders so a=2n+1.

Suppose n is even.

at step 2 there are n verts of order 0
at step 3 there is 1 vert of order n, and n or order 1
at step 4 there are 2 verts of order n, and n of order 2.

Total or orders at step 5=2n+2n=4n

Number of arcs is half the sum of the orders so a=2n.

RonL
• Jan 17th 2007, 03:43 AM
anthmoo
Thankyou! But...

Is there no possible way for there to be one nth term for this sequence??
• Jan 17th 2007, 04:16 AM
CaptainBlack
Quote:

Originally Posted by anthmoo
Thankyou! But...

Is there no possible way for there to be one nth term for this sequence??

if n is odd ceil(n/2)-floor(n/2)=1
and if n even ceil(n/2)-floor(n/2)=0

we may write:

a=2n+ceil(n/2)-floor(n/2)

RonL

(ceiling function ceil(x) is the smallest integer greater than or equal to
x, and the floor function floor(x) is the largest integer less than or equal to
x).
• Jan 17th 2007, 04:24 AM
anthmoo
Quote:

Originally Posted by CaptainBlack
if n is odd ceil(n/2)-floor(n/2)=1
and if n even ceil(n/2)-floor(n/2)=0

we may write:

a=2n+ceil(n/2)-floor(n/2)

RonL

(ceiling function ceil(x) is the smallest integer greater than or equal to
x, and the floor function floor(x) is the largest integer less than or equal to
x).

Thankyou very much man! I didn't know much about the floor/ceiling function, I figured it was a lot more complicated than that!

Thanks man!