Tag Archives: Prime Number

Mixed C++/Assembly: A Fast Algorithm to Find the First n Prime Numbers


This demo program finds the first n prime numbers using a fast algorithm with x86 32-bit assembly language. This project has been tested with Visual Studio .Net 2008 (C++) There are two constants rows (preset to 20) and cols (preset … Continue reading

Posted in Assembly, C/C++ | Tagged , , | Leave a comment

Mixed C++/Assembly: A function to find the prime factor of a number


There has already been a function to find the lowest prime factor of a number in C/C++ language in the article A function to find the prime factor of a number in C++. This article uses the same algorithm (as … Continue reading

Posted in Assembly, C/C++ | Tagged , , , , | Leave a comment

C++: Factorizing an Integer


This posting demonstrates a simple C++ project containing 3 files: main.cpp prime.h prime.cpp prime.cpp prime.cpp contains two library functions: getPrimeFactor() and getFactorizedString(). We have already commented about getPrimeFactor() in posting A function to find the prime factor of a number … Continue reading

Posted in C/C++ | Tagged , , | 1 Comment

Java (2) Array: Fast Algorithm to Find the First n Prime Numbers


For a comment about the algorithm, see the posting “Java (1) ArrayList: Fast Algorithm to Find the First n Prime Numbers” (https://911programming.wordpress.com/2010/05/20/java-1-arraylist-fast-algorithm-to-find-the-first-n-prime-numbers/) or read the comment text in the given code below. This implementation uses a fixed-size array which is … Continue reading

Posted in Java | Tagged , , | 2 Comments

Java (1) ArrayList: Fast Algorithm to Find the First n Prime Numbers


Comment about the algorithm: The best known algorithm so far is to find a divisor by which the number under test is dividable. If such a divisor is found, then the number is NOT prime. Otherwise, the number is prime. … Continue reading

Posted in Java | Tagged , , | 2 Comments

Fast Algorithm to Find the First n Prime Numbers


This demo program finds the first n prime numbers using a fast algorithm. // fastprime.cpp // The fast prime algorithm /* This demo program finds the first n prime numbers using a fast algorithm. There are two constants rows (preset … Continue reading

Posted in C/C++ | Tagged , | 1 Comment