Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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|improve this question

4 Answers 4

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|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|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|improve this answer

See http://oeis.org/A088911 ... 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|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.