PRIMES GENERATOR V 1.1 by Stanowski Etienne Stan.Etienne@caramail.com Programmed in C with Ti-Gcc, don't need any kernel. 01/10/2000 nostub mode is better than Doors one, first because the code is smaller, then it can be launched without any kernel (like a CAS function) and finally, status line don't print errors in Doors mode. Yet, you are allowed to compile it in Doors mode if you want (at your own risks : it has not been tested!) You will have to add this line : char _comment[] = "Primes Generator V 1.1 by Stanowki Etienne"; Very fast calcul time : finding all prime numbers between 1 to 1000 is bearly instantaneous! Two ways of untilisation : * "primes(A)" : answer true if A is a prime number * "primes(A,B)": gives all prime numbers between A and B. Numbers A and B must be positive and bounded by 0 and 2^31-1. Be careful, a number larger than 2^31-1 can crash your Ti. (I could have made a protection but the code would have been larger). The answer is given in a list form. N.B: 0 and 1 are not prime numbers. examples: "primes(5)" -> true "primes(1,15)" -> "{2 3 5 7 11 13}" "primes(15,1)" -> "{13 11 7 5 3 2}" The program would be upgraded when when long long numbers will be inclued in Tigcc. Whenever, i could inclued numbers larger than long long numbers but all the program would have to be changed. Ant the code would be hudge! I don't think anyone wants to have a list of all prime numbers larger than 2^31-1. Versions : v 1.1 10/01/2000 Code reduced thanks to a bit change and the new version of TiGccLib 2.2 Heigth : 589 V 1.0 09/21/2000 It works, compiled with Tigcc v 0.7 and TiGccLib 2.1 Heigth : 717 Thanks to Ti for not having made a function which gives a list of prime numbers Thanks to TiGcc team for their work and documentations. Program don't have any known bugs. I won't be responsible of any damage during the execution of the progam. The algorythm could have been faster but we would see the difference for more than 1000 numbers. You can distribut this file if you link with it readme.txt All your comments are welcomed : send them at Stan.Etienne@caramail.com. Thank you and enjoy this program.