I used a bit of Sieve of Eratosthenes and Sieve of Atkin algorithim in the most simplest form I could get it in :P Those two seem to be the most common. I was thinking of using the Wilson's Theorem but found out its only for Wilson Prime numbers...
Are we allowed to re-submit?I might add and tune a bit more since everyone is getting similar results.
~NS
We never learned about primes (yet), so I just brew something up using the Wikipedia description (I guess it's the Sieve of Eratosthenes).
I just applied a naive primality test to each number from 3 to n (1000 in this case).
I was hoping for more advanced scripting :/
Like "Make a script that will fill the gaps between the lines in this pic: http://img16.imageshack.us/img16/1754/asdfasdfo.png "





Do the algorithms need to be able to accept any number (up to the maximum number an integer can hold of course), or can they be optimized to the numbers you are giving us? For example, you have said that there are 7 prime factors for 1578833364. Are we allowed to set the length of the array that holds these numbers to 7, or must we make the function/script able to find the factors of numbers that have more than 7 factors?
SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
Programming Projects: NotePad | Tetris | Chess
Lots of stuff to reply to, fun times!
As I didn't define it and entries have done both, I would say it can be tailored to this specific problem, but preferred to not be. It was a bit of a miss on my part and I'll try to make sure it doesn't happen again. Either way though, it shouldn't overly affect the end time too much, so it's up to you.
This was really just a starter one to see how many people would actually enter. An easy to do, hard to do well problem is perfect as most people can have a go and succeed, but those with the know-how can do it oh so much better than those who do not.
It takes real skill to take the same code and make it more efficient, which is pretty useful when it comes to scripting. It's all well and good finding an algorithm online and converting it into Scar, but knowing the little tweaks that take a bit of time from here and there really shows.
I can tell you that it just about always flickers between values, but I run them multiple times then get the most common quick time, which will usually emerge from being run 5 times. If you have very little open, including system stuff, then you should end up getting pretty constant times, but it of course also depends on what you are using to time it (I'm using Nielsie's timing stuff that relate to API calls from a while back).
By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.
SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
Programming Projects: NotePad | Tetris | Chess
b..b..b..but i did make it more efficient, it was like running at 100ms when I reserached it :<
Jus' Lurkin'
100ms??
I can do both challenges in around 7ms O.o
Last edited by Markus; 09-24-2009 at 01:41 AM.
I made a new script, check it out!.
7ms? I can't get mine past 14 =\
Depends on the computer ofcourse.
My "lower" submission gets me 6.7ms (started at 14.5ms but managed to get it a lot down), and the "upper" 7.15ms (haven't spent much time optimising it though).
I made a new script, check it out!.
Announcing the entry deadline as 3pm GMT tomorrow (18 hours time as of this post). If it's not in by then, then it is not to be run for the final testing time. I am having a bit of laptop trouble, but as long as you PM'ed me the entry I'll be able to access and so time it accurately.
So, as the deadline is early afternoon tomorrow, the results will be up later in the afternoon and the next problem will be up day after tomorrow! You can expect a large increase in difficulty, but also what many will view as a better test of scripting ability (hopefully).
By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.
increase in difficulty isnt necessarily necessary. Just something that takes a lot more thinking with more ways to do it. I guess thats still kind of describing more difficulty, but i would rather have something thats very doable by most people that just takes a lot of bit of thinking/good scripting to not suck rather than something that is just technically difficult which would limit the number of ways to accomplish it usually.
SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
Programming Projects: NotePad | Tetris | Chess
Lol, mine is getting roughly 210 milliseconds, and it's missing the first ten-ninety primes (depending on what you put in).
Edit:
Aha! Forgot a + 1, finds all the primes now, but still takes 210 milliseconds xD.
Edit2:
Fastest time is 146 milliseconds now. Averaging 165-170.
~Sandstorm
Last edited by Sandstorm; 09-24-2009 at 06:46 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)