Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > 2+2 Communities > Other Other Topics
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-04-2005, 04:48 PM
TBag TBag is offline
Junior Member
 
Join Date: Sep 2004
Posts: 3
Default For all you math puzzle nuts...

I came across this problem while doing my Calc hw today. Took me awhile to get it, I thought it was a pretty neat problem.

Find a formula for the nth term of this sequence.
0, 1, 1, 2, 2, 3, 3, 4, ... (each positive integer repeated).

The whole time I was doing this I was thinking about how much easier it would be to just write a C code for it, damn calculus and it's lack of ability to round down to the nearest factor of 2. Enjoy.

Edit - fixed sequence typo, and edited to add no using mod or anything such as that. Only standard math terms, ie. + , - , x , divide, and powers.

Edited again to say that you can only use one function that will apply to your whole sequence, no dividing odds and evens between two seperate functions.
Reply With Quote
  #2  
Old 10-04-2005, 04:55 PM
Homer Homer is offline
Senior Member
 
Join Date: Sep 2002
Posts: 5,909
Default Re: For all you math puzzle nuts...

[ QUOTE ]
I came across this problem while doing my Calc hw today. Took me awhile to get it, I thought it was a pretty neat problem.

Find a formula for the nth term of this sequence.
0, 1, 1, 2, 3, 3, 4, ... (each positive integer repeated).

The whole time I was doing this I was thinking about how much easier it would be to just write a C code for it, damn calculus and it's lack of ability to round down to the nearest factor of 2. Enjoy.

[/ QUOTE ]

I assume it should be 0, 1, 1, 2, 2, 3, 3...

(n - n mod 2)/2
Reply With Quote
  #3  
Old 10-04-2005, 05:01 PM
Homer Homer is offline
Senior Member
 
Join Date: Sep 2002
Posts: 5,909
Default Re: For all you math puzzle nuts...

[ QUOTE ]
I came across this problem while doing my Calc hw today. Took me awhile to get it, I thought it was a pretty neat problem.

Find a formula for the nth term of this sequence.
0, 1, 1, 2, 2, 3, 3, 4, ... (each positive integer repeated).

The whole time I was doing this I was thinking about how much easier it would be to just write a C code for it, damn calculus and it's lack of ability to round down to the nearest factor of 2. Enjoy.

Edit - fixed sequence typo, and edited to add no using mod or anything such as that. Only standard math terms, ie. + , - , x , divide, and powers.

[/ QUOTE ]

Now you say that. Bastard! [img]/images/graemlins/smile.gif[/img]

Isn't mod a standard math term, though.

Okay, I'll try again.
Reply With Quote
  #4  
Old 10-04-2005, 05:02 PM
TBag TBag is offline
Junior Member
 
Join Date: Sep 2004
Posts: 3
Default Re: For all you math puzzle nuts...

Haha, when I said I was thinking about how easy it would be to write a C code for it instead of doing standard math procedures, I thought that would've gotten the point across [img]/images/graemlins/grin.gif[/img]
Reply With Quote
  #5  
Old 10-04-2005, 05:10 PM
BruceZ BruceZ is offline
Senior Member
 
Join Date: Sep 2002
Posts: 1,636
Default Re: For all you math puzzle nuts...

[ QUOTE ]
I came across this problem while doing my Calc hw today. Took me awhile to get it, I thought it was a pretty neat problem.

Find a formula for the nth term of this sequence.
0, 1, 1, 2, 2, 3, 3, 4, ... (each positive integer repeated).

The whole time I was doing this I was thinking about how much easier it would be to just write a C code for it, damn calculus and it's lack of ability to round down to the nearest factor of 2. Enjoy.

Edit - fixed sequence typo, and edited to add no using mod or anything such as that. Only standard math terms, ie. + , - , x , divide, and powers.

[/ QUOTE ]

f(n) = n/2 for n even
f(n) = (n+1)/2 for n odd
Reply With Quote
  #6  
Old 10-04-2005, 05:13 PM
cookie cookie is offline
Senior Member
 
Join Date: Jan 2005
Posts: 282
Default Re: For all you math puzzle nuts...

[ QUOTE ]
[ QUOTE ]
I came across this problem while doing my Calc hw today. Took me awhile to get it, I thought it was a pretty neat problem.

Find a formula for the nth term of this sequence.
0, 1, 1, 2, 2, 3, 3, 4, ... (each positive integer repeated).

The whole time I was doing this I was thinking about how much easier it would be to just write a C code for it, damn calculus and it's lack of ability to round down to the nearest factor of 2. Enjoy.

Edit - fixed sequence typo, and edited to add no using mod or anything such as that. Only standard math terms, ie. + , - , x , divide, and powers.

[/ QUOTE ]

f(n) = n/2 for n even
f(n) = (n+1)/2 for n odd

[/ QUOTE ]
f(n) = (n+1)/2 for n odd should be (n-1)/2, right?
Reply With Quote
  #7  
Old 10-04-2005, 05:14 PM
TBag TBag is offline
Junior Member
 
Join Date: Sep 2004
Posts: 3
Default Re: For all you math puzzle nuts...

Only one function is allowed. I'll post my solution (although it's a sloppy solution and I think a better one exists) before I go to class in 30 mins if no one else comes up an answer.
Reply With Quote
  #8  
Old 10-04-2005, 05:21 PM
cookie cookie is offline
Senior Member
 
Join Date: Jan 2005
Posts: 282
Default Re: For all you math puzzle nuts...

[ QUOTE ]
Only one function is allowed. I'll post my solution (although it's a sloppy solution and I think a better one exists) before I go to class in 30 mins if no one else comes up an answer.

[/ QUOTE ]
Yeah also thought the double function solution seemed to easy...
Reply With Quote
  #9  
Old 10-04-2005, 05:22 PM
Homer Homer is offline
Senior Member
 
Join Date: Sep 2002
Posts: 5,909
Default Re: For all you math puzzle nuts...

[ QUOTE ]
I came across this problem while doing my Calc hw today. Took me awhile to get it, I thought it was a pretty neat problem.

Find a formula for the nth term of this sequence.
0, 1, 1, 2, 2, 3, 3, 4, 4, ... (each positive integer repeated).

The whole time I was doing this I was thinking about how much easier it would be to just write a C code for it, damn calculus and it's lack of ability to round down to the nearest factor of 2. Enjoy.

[/ QUOTE ]

{n + (-1)^n)}/2

EDIT - [censored], that's wrong.
Reply With Quote
  #10  
Old 10-04-2005, 05:26 PM
BruceZ BruceZ is offline
Senior Member
 
Join Date: Sep 2002
Posts: 1,636
Default Re: For all you math puzzle nuts...

[ QUOTE ]
[ QUOTE ]
[ QUOTE ]
I came across this problem while doing my Calc hw today. Took me awhile to get it, I thought it was a pretty neat problem.

Find a formula for the nth term of this sequence.
0, 1, 1, 2, 2, 3, 3, 4, ... (each positive integer repeated).

The whole time I was doing this I was thinking about how much easier it would be to just write a C code for it, damn calculus and it's lack of ability to round down to the nearest factor of 2. Enjoy.

Edit - fixed sequence typo, and edited to add no using mod or anything such as that. Only standard math terms, ie. + , - , x , divide, and powers.

[/ QUOTE ]

f(n) = n/2 for n even
f(n) = (n+1)/2 for n odd

[/ QUOTE ]
f(n) = (n+1)/2 for n odd should be (n-1)/2, right?

[/ QUOTE ]

No, f(0) = 0, f(1) = 1, unless you want to start from f(1), and then it would be (n-1)/2.

One equation? OK, f(n) = {n + [1 - (-1)^n]/2}/2

Or if you start from f(1) = 0, then f(n) = {n - [1 - (-1)^n]/2}/2
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.