Search the Community
Showing results for tags 'primes'.
Total Marionette beginner here. Spiral pattern of dots in polar coordinates looks like a thing that could be done in vwx with marionette: Therefore, trying to make a bunch of lines in polar coordinate that start at Origin and have Length = R, Angle = θ (radians about the origin) such that R=θ eg 2,2 represents a line of length 2 that is rotated 2 radians. This is my attempted network to make any one of the lines: This net returns a line on x axis of Length = value in the Int node (eg 2, or 5, or other integer). But no rotation. Perhaps because the pEnd needs both x,y? With only 1 input (x) from the Int node it assumes y =0 and ignores the rotation. Strange, but the net returns nothing if I name any of the nodes. eg if I name the Point2 node 0_0 to indicate the origin. If I ever get the line part, I would then try to replace the Int node with a network made to step through a range of prime numbers and return a line for each prime, and place a dot at the end point of each line, to produce the fun spiral pattern. Oiy, so much to learn! Or Maybe a better approach is to forget the lines and directly place dots based on sine & cosine of the polar coords? Have to think about that one. Also I see no prime number node. What is technique for accessing external list of primes (eg in a worksheet or text block )? Any suggestions or help or pointers to resources welcome. Thanks -B
Thanks to help from a programmer/coder friend (Mr J), internet posts of python prime number generators, and tips on Community Board I was able to modify a Series node to become a Prime Number Generator with range inputs. Sample attached as a v1. (Note - I am totally not educated or capable in python or other scripting. Dependent on others.) Any comments, improvements or alternatives welcome. Here is the prime generator python script from Scanftree.com http://scanftree.com/programs/python/python-program-to-print-all-prime-numbers-in-an-interval/ The Standard Series node uses a List [ ] output. Mr J and I could not make that work, so commented it out. He tried .append instead which apparently works well. See it in action in this thread: Prime Series Node.vwx