is there a Pd object for generating prime numbers?
currently I'm:
[1 2 3 5 7 9...97]
|
|
[metro] |
| |
[list=dripslow]
|
[foo]
I have no clue if it exists in a pd-object, but its easy to compile and external with some generator from the web:
http://snipplr.com/view/1219/c-prime-number-generator/ (do you want it to output numbers on bang? all at the same time - I tested that code just now... seems fine and can be tuned to how many primes you want.)
other way to go: you could grab them from a file (of stored primes) or from an online prime generator =P
On Sat, Sep 11, 2010 at 9:33 PM, Kim Cascone kim@anechoicmedia.com wrote:
is there a Pd object for generating prime numbers?
currently I'm:
[1 2 3 5 7 9...97] | | [metro] | | | [list=dripslow] | [foo]
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
pedro@arkana:~/Apps/pure-data/externals$ find . -name "*prime*" -type f -print 2>/dev/null ./zexy/tests/help-msg/prime.pd ./zexy/tests/help-msg/.svn/text-base/prime.pd.svn-base ./zexy/src/prime.c ./zexy/src/.svn/text-base/prime.c.svn-base ./zexy/reference/prime-help.pd ./zexy/reference/.svn/text-base/prime-help.pd.svn-base ./zexy/reference/.svn/prop-base/prime-help.pd.svn-base
Seems that there are some prime related stuff (not sure what they do.. have to look further into them) in pd-externals, maybe one can do the trick.
On Sat, Sep 11, 2010 at 10:48 PM, Pedro Lopes pedro.lopes@ist.utl.ptwrote:
I have no clue if it exists in a pd-object, but its easy to compile and external with some generator from the web:
http://snipplr.com/view/1219/c-prime-number-generator/ (do you want it to output numbers on bang? all at the same time - I tested that code just now... seems fine and can be tuned to how many primes you want.)
other way to go: you could grab them from a file (of stored primes) or from an online prime generator =P
On Sat, Sep 11, 2010 at 9:33 PM, Kim Cascone kim@anechoicmedia.comwrote:
is there a Pd object for generating prime numbers?
currently I'm:
[1 2 3 5 7 9...97] | | [metro] | | | [list=dripslow] | [foo]
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-- Pedro Lopes (ongoing MSc) contact: pedro.lopes@ist.utl.pt website: http://web.ist.utl.pt/Pedro.Lopes
Yep, zexy will do the trick.
/* get the n-th prime number */ <- what you need, right?
I guess IOhannes m zmölnig could help you more than me on that matter :)
Best regards, Pedro p.s.: sorry for the triple-posted message... I'm slow today.
On Sat, Sep 11, 2010 at 10:50 PM, Pedro Lopes pedro.lopes@ist.utl.ptwrote:
pedro@arkana:~/Apps/pure-data/externals$ find . -name "*prime*" -type f -print 2>/dev/null ./zexy/tests/help-msg/prime.pd ./zexy/tests/help-msg/.svn/text-base/prime.pd.svn-base ./zexy/src/prime.c ./zexy/src/.svn/text-base/prime.c.svn-base ./zexy/reference/prime-help.pd ./zexy/reference/.svn/text-base/prime-help.pd.svn-base ./zexy/reference/.svn/prop-base/prime-help.pd.svn-base
Seems that there are some prime related stuff (not sure what they do.. have to look further into them) in pd-externals, maybe one can do the trick.
On Sat, Sep 11, 2010 at 10:48 PM, Pedro Lopes pedro.lopes@ist.utl.ptwrote:
I have no clue if it exists in a pd-object, but its easy to compile and external with some generator from the web:
http://snipplr.com/view/1219/c-prime-number-generator/ (do you want it to output numbers on bang? all at the same time - I tested that code just now... seems fine and can be tuned to how many primes you want.)
other way to go: you could grab them from a file (of stored primes) or from an online prime generator =P
On Sat, Sep 11, 2010 at 9:33 PM, Kim Cascone kim@anechoicmedia.comwrote:
is there a Pd object for generating prime numbers?
currently I'm:
[1 2 3 5 7 9...97] | | [metro] | | | [list=dripslow] | [foo]
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-- Pedro Lopes (ongoing MSc) contact: pedro.lopes@ist.utl.pt website: http://web.ist.utl.pt/Pedro.Lopes
-- Pedro Lopes (ongoing MSc) contact: pedro.lopes@ist.utl.pt website: http://web.ist.utl.pt/Pedro.Lopes
Hi,
On Sat, Sep 11, 2010 at 10:48:05PM +0100, Pedro Lopes wrote:
other way to go: you could grab them from a file (of stored primes) or from an online prime generator =P
Actually that's what I would do. And did, see attachment. The numbers come from http://primes.utm.edu/lists/small/1000.txt
They are included twice to allow random and sequential access to the first 1000 primes.
Frank Barknecht Do You RjDj.me? _ ______footils.org__
On Sun, 12 Sep 2010, Frank Barknecht wrote:
On Sat, Sep 11, 2010 at 10:48:05PM +0100, Pedro Lopes wrote:
other way to go: you could grab them from a file (of stored primes) or from an online prime generator =P
Actually that's what I would do. And did, see attachment. The numbers come from http://primes.utm.edu/lists/small/1000.txt They are included twice to allow random and sequential access to the first 1000 primes.
Also, because the 1000th prime is 7919 and because 7919*7919 = 62710561 >= 16777216, then that list of primes is enough for anything you can do with pd's normal floats. It can even be said that you only would ever need the first 574 primes when using the float format to represent whole numbers : the 574th prime is the biggest prime you'll need to figure out that any bigger float is a prime number, up to the limit where whole odd floats stop to exist. It's because it's the last prime before 4096, and 4096*4096 = the limit itself.
| Mathieu Bouchard ------------------------------ Villeray, Montréal, QC
On Sat, 11 Sep 2010, Kim Cascone wrote:
is there a Pd object for generating prime numbers? currently I'm: [1 2 3 5 7 9...97]
1 is not a prime number. (9 is not a prime number either)
then your ascii art is not coming out properly because you don't use a fixed-width font. see how it comes out here : http://lists.puredata.info/pipermail/pd-list/2010-09/082440.html
then I'm wondering why you use [list-dripslow] instead of [list-drip].
| Mathieu Bouchard ------------------------------ Villeray, Montréal, QC
Mathieu Bouchard wrote:
On Sat, 11 Sep 2010, Kim Cascone wrote:
is there a Pd object for generating prime numbers? currently I'm: [1 2 3 5 7 9...97]
1 is not a prime number. (9 is not a prime number either)
whaat? we live under new rules?
i'm astonished one guy speaking can thinks he makes some 'truth'
hey
sevy
ydegoyon@gmail.com wrote:
Mathieu Bouchard wrote:
On Sat, 11 Sep 2010, Kim Cascone wrote:
is there a Pd object for generating prime numbers? currently I'm: [1 2 3 5 7 9...97]
1 is not a prime number. (9 is not a prime number either)
whaat? we live under new rules?
i'm astonished one guy speaking can thinks he makes some 'truth'
hey
sevy
i just read '1 is not a prime number' of course 9 is not, ut a prime number can only be divided by 1 and itself, so why 1 can't be?
the correct list is :
1 2 3 5 7 11 ...
we all know that, so don't need a mailing list teacher
ciao, sevy
On Sun, 12 Sep 2010, ydegoyon@gmail.com wrote:
i just read '1 is not a prime number' of course 9 is not, ut a prime number can only be divided by 1 and itself, so why 1 can't be?
http://fr.wikipedia.org/wiki/Nombre_premier
we all know that
who is that 'we' ? strange...
| Mathieu Bouchard ------------------------------ Villeray, Montréal, QC
Hi,
On 12/09/10 04:33, ydegoyon@gmail.com wrote:
Mathieu Bouchard wrote:
On Sat, 11 Sep 2010, Kim Cascone wrote:
is there a Pd object for generating prime numbers? currently I'm: [1 2 3 5 7 9...97]
1 is not a prime number. (9 is not a prime number either)
i just read '1 is not a prime number' of course 9 is not, ut a prime number can only be divided by 1 and itself, so why 1 can't be?
1 is special and unique, it has only 1 factor (itself). I'd guess that 0 has an infinite number of factors, but I'm not sure on this. In any case it's probably special too.
Mathematicians almost all agree that 1 should not be classified as prime, because it does not have exactly 2 distinct factors. The main reason is that if you leave out the number 1 from the set of prime numbers, you can prove nice uniqueness theorems about prime factorization:
http://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic
The name shows just how important that property is considered to be. The uniqueness of prime factorization can be used to show some quite impressive things, see for example:
http://en.wikipedia.org/wiki/Goedel_numbering
used to prove that "you can't prove everything" (or something along those lines, I've not studied this maths in enough depth).
there's zexy/prime, which detects if a number is prime.
is there a Pd object for generating prime numbers?
currently I'm:
[1 2 3 5 7 9...97] | | [metro] | | | [list=dripslow] | [foo]
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
On 11/09/10 21:33, Kim Cascone wrote:
is there a Pd object for generating prime numbers?
A prime number has exactly two factors (1 and itself). I attached an abstraction to generate a list of all factors of a number, which could be used to see if a number is prime (inefficiently).
On Sun, 12 Sep 2010, Claude Heiland-Allen wrote:
A prime number has exactly two factors (1 and itself). I attached an abstraction to generate a list of all factors of a number, which could be used to see if a number is prime (inefficiently).
This slightly modified version runs in time O(sqrt(n)) instead of O(n)...
I'm not not counting the step of putting the factors together as list, but if I did, we'd have to write it as O(sqrt(n)+factors^2) and O(n+factors^2) respectively. This could be fixed using the usual messagebox trick.
| Mathieu Bouchard ------------------------------ Villeray, Montréal, QC