Browse Search Popular Register Upload Rules User list Login:
Search:
Prime-Number-Spotter

Image:
screenshot of the scene

Author: FRA32

Group: Technical

Filesize: 23.01 kB

Date added: 2016-01-08

Rating: 5

Downloads: 614

Views: 275

Comments: 8

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

This scene contains an object that maps the number line as a spiral and checks if it hits a prime number by dividing it by every preceeding number until it hit's a clean division. Note how the prime numbers form visible diagonals when viewed after a while.

Fun fact: the 25 black boxes were created by copying a single box with the text "1" and the onSpawn code (e)=>{text = "" + (math.toint(text)+1)} multiple times, automatically increasing the number everytime I duplicate a box.

Edit 1: Increased speed by making the calculator automatically register the number as prime if the dividing counter is larger than the current checked number divided by 2 (since there's no other natural number other than 1 and 0 lower than 2)

Edit 2: Altered the code for even more calculation speed at larger number scales by automatically skipping everything past the square root of the number , since the following numbers would just be inversions of the previous ones(i.e 100 / 20 = 5, 100 / 5 = 20 -> if X / Y = Z and X % Y != 0 -> X%Z is not neccessary to be calculates since Z is not a natural number). The only exception is 2 as it's square root is right between 2 and 1 and so needs to be handled manually.

Edit 3: Removed 1 from the prime numbers:lol:

Edit 4: Removed the output of non-prime numbers, increased stepping speed by skipping all even numbers except 2.
Last edited at 2016/07/03 21:50:38 by FRA32
Please log in to rate this scene
edit
Similar scenes
Title: Prime number art
Rating: 5.125
Filesize: 41.79 kB
Downloads: 25
Comments: 2
Ratings: 2
Date added: 2020/02/07 01:43:13
Made with: Algodoo v2.1.0
Rating: rated 5.1
download
Title: Modulus-Matrix
Rating: 5
Filesize: 183.54 kB
Downloads: 419
Comments: 3
Ratings: 1
Date added: 2016/01/07 20:41:37
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Algicosathalon Day Two (Pt. 1)
Rating: 5
Filesize: 0.85 MB
Downloads: 253
Comments: 2
Ratings: 1
Date added: 2018/06/18 22:49:30
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: A better opimus prime.
Rating: 7.1667
Filesize: 188.68 kB
Downloads: 493
Comments: 2
Ratings: 6
Date added: 2008/10/28 19:59:19
Made with: Phun
Rating: rated 7.2
download
Title: optimus prime test rig
Rating: 4.5
Filesize: 67.34 kB
Downloads: 251
Comments: 7
Ratings: 2
Date added: 2009/02/15 10:16:44
Made with: Phun
Rating: rated 4.5
download
Title: Marble algicosathlon Season II signups!
Rating: 5
Filesize: 21.67 kB
Downloads: 143
Comments: 9
Ratings: 1
Date added: 2018/03/30 17:10:25
Made with: Algodoo v2.1.0
Rating: rated 5
download
Responses to this scene
show list
Title: Prime Number Spotter Histogram
Rating: 5
Filesize: 51.31 kB
Downloads: 321
Comments: 5
Ratings: 1
Date added: 2016/01/09 11:41:05
Made with: Algodoo v2.1.0
Rating: rated 5
download
i like it!
Nice! Im wondering how high it goes
Also, there is a number thats labeled Prime but its actually not. Can you find it?
1 is not a prime.
Found it!:D
Okay I will remove 1 from the prime spotter xD.

Abot the limit: As far as you want, as long as you have the ability to handle about 2000 number-boxes:lol:

If you want to see how it looks at high scale, visit the Algodoo building community I link to in most scenes. Right now I posted an image there which has been spotted by a self coded Java Programm. It had the same way of working as in this scene, but the spiral ranges from 1(center) to 450 SQUARED. There you can also see the miraculous prime-diagonals(diagonals across the spiral area with high prime density)
Nice work. I suggest not spawning the blue, non-prime, squares but moving anyway so that you end up with the same pattern but without the blue background. That way Algodoo can maintain less objects.
@RAMTurtle I bet it goes up to 999,999,999,999,999,999,999,999,999