Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to find equations of this list: $[1,1,1,0,0,0,1,1,1,0,0,0, ...]$ (it's periodic)

The closest equation I've got is $\left\lceil \sin (\frac{\pi}{3}x)\right\rceil $, which looks like this:

  _   _   _
_| |_| |_| |_

But I need it to look like this:

  _   _   _
_/ \_/ \_/ \_

Can you help me?

share|cite|improve this question
up vote 1 down vote accepted

You may try the simple function $$f(x)=|(x-s) \bmod 6 -3|-1$$ (the 'shift' $s$ is $0$ for the first list , $1$ for the second and so on...)
by replacing values over $1$ by $1$ and under $0$ by $0$

Or don't you allow tests?

share|cite|improve this answer
Your solution is almost right. The correct function would be $max(0,min(your function,1))$. I like your solution better because it's simpler. – Cobold Aug 8 '12 at 9:25
@Cobold: yes it is nicer combined with J.M.'s max(min()) classical trick (note my (misplaced) "by replacing values over 1 by..."). Glad you liked it anyway, – Raymond Manzoni Aug 8 '12 at 9:34

I'd use


share|cite|improve this answer

It seems you are looking for the left shift operator $S_l$: $$ S_l: (x_j)_{j=1}^{\infty}\mapsto (x_j)_{j=2}^{\infty} $$ It simply crosses out the first component of the sequence. You can write your whole sequence $(x^{(n)})_{n=1}^{\infty}$of "lists" as powers of this operator $S_l$: $x^{(n)} = S^{n-1}_lx^{(1)}$

I hope this helps.

share|cite|improve this answer

See ... The $n$th term ($n = 0, 1, 2, ...)$ of the sequence $1^k 0^k 1^k 0^k ...$ is

$$a(n,k) = \left\lfloor \frac{(n+k)\mod 2k}{k}\right\rfloor$$

so your function can be written

$$f(n) = a(n,3) = \left\lfloor \frac{(n+3)\mod 6}{3}\right\rfloor.$$

The linked article also shows other ways to write it.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.