New Reply

general function that represents a series of 1 and 0

 
Share Thread Thread Tools
Nov4-11, 02:07 PM   #1
 

general function that represents a series of 1 and 0


How can I get a general function that represents a series of 1 and 0, for example :
1,0,1,0,1,0,1,0...; but also
1,1,0,1,1,0,1,1,0...;
1,1,1,0,1,1,1,0,1... and so on; the first one is not difficult: a = n mod 2; where a=1 or 0; n=1,2,3...
but if n=1 than a=2 (for the first one), and 2 is not solution
That s one of the other difficulties in that problem.

So I just need a general function for an x number of 1 (1,1,1,1...1,0,1,1,1,1,...0...). Always after a certain period of number 1 comes 0
The function must be valuable for all n; as you can see in my example when I put n=1, a=2, and that isn t solution
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> King Richard III found in 'untidy lozenge-shaped grave'
>> Google Drive sports new view and scan enhancements
>> Researcher admits mistakes in stem cell study
Nov4-11, 02:35 PM   #2
 
Recognitions:
Science Advisor Science Advisor
well if p is a prime number, then

f(n) = np-1 mod p will work.

but if we want a function where the 0's come every six places, this approach won't work:

f(n) = n5 mod 6 gives:

(1,2,3,4,5,0,1,2,3,4,5,0,.....)
Nov4-11, 02:55 PM   #3
 
I want a general formula for all terms, including a function where the 0 s come every six places, and if its possible without primes.
The function must be strictly given for ALL TERMS and proven
Nov4-11, 06:35 PM   #4
D H
 
Mentor

general function that represents a series of 1 and 0


What's wrong with divides? (Or not divides in this case.)
Nov5-11, 05:12 AM   #5
 
Can you give an example including that function f(n) = np-1 mod p for
the series 1,1,1,0,1,1,1,0...; what is n in your case, which prime I have to put instead p... Explain this function.
Nov5-11, 06:50 AM   #6
 
Recognitions:
Science Advisor Science Advisor
Let w be a primitive m+1'th root of unity, say [itex]w = e^{i\frac{2\pi}{m+1}}[/itex].

Look at [tex]x_n = \frac{1+w^n+w^{2n}+...+w^{mn}}{m+1}.[/tex]

We will have that [itex]x_0 = 1, x_1 = x_2 = ... = x_m = 0[/itex]. And then it repeats itself.

If we take [itex]y_n = 1-x_{n+1}[/itex] we will get the series [itex]y_1,y_2,... = 1,1,...,1,0,1,,1,...,1...[/itex] where there are m 1's for each repeat.

The reason for this is that for each n [itex]w^n[/itex] is a k'th root of unity for some divisor k of m+1. k = 1 only when n is a multiple of m+1, i.e. n=0,m+1,2(m+1),... and so on. For these n [itex]x_n[/itex] will of course be 1.

When n is not a multiple of m+1, then k will not be equal to 1, and [itex]1+w^n + (w^n)^2 +...+(w^n)^{k-1} = 0[/itex]. So the series [itex]1+w^n+w^{2n}+...+w^{mn} = (1+w^n + (w^n)^2 + ... + (w^n)^{k-1}) + (w^n)^k(1+w^n + (w^n)^2 + ... + (w^n)^{k-1}) + ... + (w^n)^{k(\frac{m+1}{k})-1)}(1+w^n + (w^n)^2 + ... + (w^n)^{k-1}) = 0[/itex], and thus [itex]x_n = 0[/itex]. Note that for prime m+1, k will be equal to m+1 for all n except multiples of m+1.

For your first example we will get [itex]y_n = 1-\frac{1+(-1)^{n+1}}{2} = \frac{1-(-1)^{n+1}}{2}[/itex], as -1 is a primitive 2nd root of unity.

Generally [tex]y_n = \frac{m-(w^{n+1}+w^{2(n+1)}+...+w^{m(n+1)})}{m+1},[/tex] or [tex]\frac{m-(e^{i\frac{2\pi(n+1)}{m+1}}+e^{i\frac{2\pi 2(n+1)}{m+1}}+...+e^{i\frac{2\pi m(n+1)}{m+1}})}{m+1}.[/tex]
Nov5-11, 06:58 AM   #7
D H
 
Mentor
I'll repeat, what's wrong with "divides"? The sequence {a divides n} for a given a and n comprising the positive integers is the opposite of what you want. Take the logical negation and voila! there is your set of sequences.

By the way, you have a missing sequence, the trivial sequence, in your set of sequences. It is the sequence 0,0,0,... So let's start with this in terms of "divides". 1 divides every positive integer, so the sequence given by {dn;1} where dn;1 is 1 divides n is the sequence of all ones (or all true). The logical negation of this sequence yields the trivial series 0,0,0,... .

Now look at using 2 as the divisor. 2 does not divide 1, it divides 2, it does not divide 3, and so on. Thus {dn;2} = {2 divides n} yields 0,1,0,1,... . The logical negation of this sequence yields 1,0,1,0,... : your first example.

Now look at using 3 the divisor. 3 divides n results in the sequence 0,0,1,0,0,1,... . The logical negation yields 1,1,0,1,1,0 : your second example. Doing the same with 4 yields 1,1,1,0,1,1,1,0,...

Divides (or does not divide) is exactly what you want here.
Nov5-11, 09:32 AM   #8
 
D H is right. And to add to that, if you want complex sequences (repeating pulse train rather than a simple rectangular wave) then just Boolean-OR multiple divide terms.
Nov5-11, 09:45 AM   #9
 
Recognitions:
Science Advisor Science Advisor
D H's solution is perfectly fine, it's more or less the definition of the sequences in question.
Nov5-11, 10:58 AM   #10
 
disregardthat s function is fine but what if there is a huge number of 1
1,1,1,1,1,1,1,1,1,1,1,1,1,...,1,0,1,...; than there is a lot of calculating;
does exist a summation of
∑_(k=1, to m) e^((2iπk(n+1))/(m+1))
Nov5-11, 11:00 AM   #11
 
Recognitions:
Science Advisor Science Advisor
Quote by streber View Post
disregardthat s function is fine but what if there is a huge number of 1
1,1,1,1,1,1,1,1,1,1,1,1,1,...,1,0,1,...; than there is a lot of calculating;
does exist a summation of
∑_(k=1, to m) e^((2iπk(n+1))/(m+1))
Well, you don't have to do it manually. You already know what the number is anyway.
Nov5-11, 11:04 AM   #12
 
Yes, but I need that function for sth else and I have to get a general function
Is there exists a solution of summation that gave streber?
Nov5-11, 11:11 AM   #13
 
Oh, and I can t understand deveno s function; can u explain me
f(n) = n^(p-1) mod p; what if I had a composite number?
Nov5-11, 11:47 AM   #14
 
I tried to solve the summation by wolfram alpha, but the program doesn t give me a solution. Have you another function but with mod function or sth else, as if H D s function, but his function works just for primes.
Nov5-11, 10:33 PM   #15
 
Quote by Emilijo View Post
Yes, but I need that function for sth else and I have to get a general function
Sorry this doesn't make sense.

When you say
1,1,1,1,...,1,0,1,1,...
you need to know beforehand where that first 0 is. Otherwise you can't write down the problem. As soon as you fix where that first 0 is, D H's formula gives the answer immediately.

So if your problem is "first zero is at 105" then "negation of 105 divides x" is the answer.
Similarly if "first zero is at m" then "negation of m divides x" is the answer.
Nov5-11, 10:59 PM   #16
 
[itex]1-\left\lfloor\frac{n}{6}\right\rfloor + \left\lfloor\frac{n-1}{6}\right\rfloor[/itex]
Nov6-11, 12:39 AM   #17
 
Xitami, n = 13.

Edit: Scratch that. I mucked my calculations.
New Reply
Thread Tools