Start with x then alternate on each side of x until you reach 0 on one side and maxNum on the other. Need to do this in some programming code but can't nail it down. How would you write out the formula for that sequence?

funnyantyLEy

funnyantyLEy

Answered question

2022-11-25

Start with x then alternate on each side of x until you reach 0 on one side and maxNum on the other. Need to do this in some programming code but can't nail it down. How would you write out the formula for that sequence?

Answer & Explanation

driwant9HB

driwant9HB

Beginner2022-11-26Added 11 answers

Let n start at 0 and x be the initial value for the sequence then take an(x)=
a n ( x ) = { x n 2 , n 0 mod ( 2 ) x + n + 1 2 , n 1 mod ( 2 )

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?