Incidentally, my primality testing uses a parallelized version of the Sieve of Sundaram. It's incredibly fast for most numbers because it produces only as many primes as it needs to.
In mathematics, the sieve of Sundaram is a simple deterministic algorithm for finding all prime numbers up to a specified integer. It was discovered by Indian mathematician S. P. Sundaram in 1934.
== AlgorithmEdit ==
Start with a list of the integers from 1 to n. From this list, remove all numbers of the form i + j + 2ij where:
The remaining numbers are doubled and incremented by one, giving a list of the odd prime numbers (i.e., all primes except 2) below 2n + 2.
The sieve of Sundaram sieves out the composite numbers just as sieve of Eratosthenes does, but even numbers are not considered; the...
Rearrangement Inequality
Background
The Rearrangement Inequality is an inequality that is based on rearranging numbers. If I have two lists of numbers of the same length, x0, x1, x2...xn-1 and y0, y1, y2...yn-1 of the same length, where I am allowed to rearrange the numbers into the list, a way...
Wheel factorization is a method for performing a preliminary reduction in the number of potential primes from the initial set of all natural numbers 2 and greater; possibly prior to passing the result list of potential primes to the Sieve of Eratosthenes or other sieve that separates prime numbers from composites, but may further be used as a prime number wheel sieve in its own right by recursively applying the factorization wheel generation algorithm. Much definitive work on wheel factorization, sieves using wheel factorization, and wheel sieve, was done by Paul Pritchard in formulating a series...
Rotor, 32 bytes
>1N2{3%!"Fizz"~5%!"Buzz"N$?~N}\
This has one unprintable, so here's a hexdump:
0000000: 3e31 4e7f 327b 3325 2122 4669 7a7a 227e >1N.2{3%!"Fizz"~
0000010: 3525 2122 4275 7a7a 224e 243f 7e4e 7d5c 5%!"Buzz"N$?~N}\
Explanation:
> Switch to string wheel.
1 Push a one to the...
@El'endiaStarman Sadly I realized that maliciously crafted inputs (like print "lol") would cause the 0-byte cat program to break since STDIN is evaluated before being put on the stack.
And since I have no other way of taking input currently, cat will have to wait.
Prime Numbers
Goal:
Take no output and print first 100 prime numbers to STDOUT. All standard code-golf rules are applied. Shortest code in byte wins.
Restrictions:
No usage of built-in or external methods or functions that returns a prime number.
Any suggestions? Thanks.
In the answer, I'm using some features from the old interpreter, which aren't implemented in the new one, and some features from the new one, which aren't in the old one.
You should make it print something to the console and terminate instead of producing a "fractal.exe has stopped working" error popup if you provide the wrong number of arguments.
@Maltysen Here's the current code. The interpreter is now written in C, and I need to call it from Python. The new IDE needs to basically be this, but translated into Python.
Rotor, 32 bytes
>1N2{3%!"Fizz"~5%!"Buzz"N$?~N}\
This has one unprintable, so here's a hexdump:
0000000: 3e31 4e7f 327b 3325 2122 4669 7a7a 227e >1N.2{3%!"Fizz"~
0000010: 3525 2122 4275 7a7a 224e 243f 7e4e 7d5c 5%!"Buzz"N$?~N}\
Explanation:
> Switch to string wheel.
1 Push a one to the...
@Doorknob ha ha
@phase That wasn't a secret reply. That was a regular reply.