1
$\begingroup$

$a_{n,3}$

$$1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,\cdots \cdots $$

$a_{n,5}$

$$1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,\cdots \cdots $$

$a_{n,7}$

$$1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,\cdots \cdots $$

$$\vdots $$

$a_{n,2k+1}$

$$1,\cdots \cdots\cdots \cdots,1,\cdots \cdots\cdots \cdots,\overbrace{1,\cdots \cdots\cdots \cdots}^{2k+1},1,\cdots \cdots\cdots \cdots,1,\cdots \cdots$$

I found $$a_{n,k}= \left \lfloor \left | \cos\frac{\pi (n-1)}{2k+1} \right | \right \rfloor$$ but this term include abs and floorfucntion.

I mean i want the General Term without abs and floorfucntion.(plus sum)

Any hints will be appreciated, thank you.

  • 2
    I am curious about *why* you want something other than the usual $a_{n,k}=1$ if $n \equiv 1 \pmod{2k+1}$, $a_{n,k}=0$ otherwise? Pure curiosity? A programming problem in a very linited setting? If we knew more about the reason, a more satisfying answer might be possible.2011-07-16
  • 1
    If your computing environment is the sort of computing environment where `TRUE` is 1 and `FALSE` is 0 (C, for instance), then joriki's answer becomes even more practical...2011-07-17

3 Answers 3

3

The following is a technically correct answer to the question, though that depends on what kind of technician you are. The answer is quite close to the OP's proposal. Let
$$f(n,k)=\sin^2\left(\frac{\pi(n-1)}{2k+1}\right).$$

Let $$g(n,k)=0^{f(n,k)}.$$

Then, with a few largish caveats, $g(n,k)$ does the job.

Explanation: The issue, of course, is what do we mean by $0^0$? In calculus courses it is best to consider $0^0$ to be undefined. That is, however, not a universal convention.

For example, according to the IEEE floating point standard 754-2008 for the operation pow, $0^0=1$, and $0$ to a positive power is $0$. A Wikipedia article (what else?) tells me that many computer languages implement this standard. A few desultory tests with the Google calculating utility seem to show that it also implements the standard.

Added: The procedure will break down for very large $k$, because of implementation details of the IEEE standard. We can delay the breakdown by using a function that goes to $0$ more slowly than $\sin^2$ near integer multiples of $\pi$. But since presumably the question is not motivated by practical considerations, I will not suggest such modifications.

  • 0
    Therfore, as always, what $0^0$ "is" completely depends on the environment... :)2011-07-17
  • 0
    @J.M.: Absolutely. There is no way otherwise to produce that kind of discontinuity with the narrow range of "allowed" functions.2011-07-17
  • 0
    ...which reminds me, your proposal is quite related to ones by Libri and Möbius, as recounted [here](http://mathdl.maa.org/images/upload_library/22/Ford/knuth403-422.pdf) (see p. 406 onwards). (added: now that I can upvote, I gave a +1 for "But since presumably the question is not motivated by practical considerations, I will not suggest such modifications." :D )2011-07-17
  • 0
    @J.M.: Thanks for the link, it is always a pleasure to read Knuth.2011-07-17
  • 0
    @ks0830: No problem, I wrote it up for fun. In your answer involving $\cos$, you can square instead of using absolute value, thereby having only one operation you don't approve of instead of two. With the standard continuous real functions, one cannot do better than one except by using mathematically suspect quirks of computer implementation.2011-07-17
5

$$a_{n,j}=\frac1j\sum_{k=0}^{j-1}\mathrm e^{2\pi\mathrm i(n-1)k/j}$$

If you want to avoid the summation, you can apply the formula for a geometric sum to get

$$a_{n,j}=\frac1j\frac{1-\mathrm e^{2\pi\mathrm i(n-1)}}{1-\mathrm e^{2\pi\mathrm i(n-1)/j}}\;.$$

This isn't actually defined for $n=1$, but the limit for $n\to1$ is the value you want.

  • 0
    Then I suggest you give a clear and complete definition of "closed form" in the question.2011-07-16
  • 0
    This is neat. In fact you could apply fourier analysis to all sorts of continuous or smooth functions extending the values given to the real numbers. And if limits are allowed there are other formulations which would work as 'closed formulae' but which would probably not be useful computationally.2011-07-16
4

$$a_{n,j}=\delta_{1,n \,\bmod\,j}$$

  • 0
    Judging from the OP's own suggestion his indexing begins from $n=1$ as opposed $n=0$. Also, it looks like you want to look at the remainder of $n$ modulo $j$ - not the other way round.2011-07-16
  • 0
    Thanks, you're right on both accounts -- I edited accordingly.2011-07-16
  • 1
    @ks0830: We can try -- I've never done that before -- I've entered the mathematics chat room at http://chat.stackexchange.com/rooms/36/mathematics now.2011-07-16