answersLogoWhite

0


Best Answer

10 REM I believe this program will do what you want, but bear in mind that

20 REM I don't have GWBASIC and haven't used it in years, so I'm going by

30 REM memory and human error checking alone. There may be typos and

40 REM the like. This program finds up to MAXPRIMES prime numbers and

50 REM stores them in the array PRIME. It's then dumped out on the screen.

60 REM Enjoy!

70 REM

100 DEFINT A-Z

110 MAXPRIMES=1000:NUMPRIMES=2

120 DIM PRIME(1000)

130 PRIME(0) = 2:PRIME(1) = 3

140 CURRENTNUM = 5

150 WHILE(NUMPRIMES < MAXPRIMES)

160 TESTNUMBER = CURRENTNUM

170 GOSUB 1010

180 IF ISPRIME = 1THEN

190 PRIME(NUMPRIMES) = CURRENTNUM

200 NUMPRIMES = NUMPRIMES + 1

210 END IF

220 REM -- take advantage of the fact that all primes greater than

230 REM -- three are one away from a multiple of six

240 IF (CURRENTNUM + 1) MOD 6 = 0 THEN

250 CURRENTNUM = CURRENTNUM + 2

260 ELSE

270 CURRENTNUM = CURRENTNUM + 4

280 END IF

290 WEND

300 REM =============

992 REM

1000 REM A Subroutine to see if the number TESTNUMBER is prime

1010 N = 0

1020 ISPRIME = 1

1030 WHILE ISPRIME = 1 AND N < NUMPRIMES AND PRIME(N) * PRIME(N) <= TESTNUMBER

1040 IF TESTNUMBER MOD PRIME(N) = 0 THEN ISPPRIME = 0

1050 N = N + 1

1060 WEND

1070 RETURN

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Gw basicCode for prime numbers
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

How many prime numbers between 1 and 8888888888888888888888888888888888888888888888?

How ma How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and ny prime numbers between 1 and


What is the total of the next eight prime numbers after twenty four?

Just go to a table of prime numbers, find the prime numbers, and add them.Just go to a table of prime numbers, find the prime numbers, and add them.Just go to a table of prime numbers, find the prime numbers, and add them.Just go to a table of prime numbers, find the prime numbers, and add them.


what are the numbers for not prime numbers?

Numbers that are not prime numbers are called composite numbers.


Why are prime numbers divisible?

Prime numbers are divisible because any numbers that are divisible are prime. If a number isn't divisible, it isn't prime. Prime numbers have to be divisible by at least one pair of numbers to be prime.


How can prime numbers be used in your everyday life?

Prime numbers are used to find the LCM of numbers Prime numbers are used to find the HCF of numbers Prime numbers are used to simplify fractions Prime numbers are used to find the LCD of fractions

Related questions

How many prime numbers between 1 and 8888888888888888888888888888888888888888888888?

How ma How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and How many prime numbers between 1 and ny prime numbers between 1 and


What is the total of the next eight prime numbers after twenty four?

Just go to a table of prime numbers, find the prime numbers, and add them.Just go to a table of prime numbers, find the prime numbers, and add them.Just go to a table of prime numbers, find the prime numbers, and add them.Just go to a table of prime numbers, find the prime numbers, and add them.


What are numbers that have 2 factors called?

Prime numbers like 2, 3, 5 and 7.


what are the numbers for not prime numbers?

Numbers that are not prime numbers are called composite numbers.


Are any two prime numbers relatively prime?

Any two prime numbers will be relatively prime. Numbers are relatively prime if they do not have any prime factors in common. Prime numbers have only themselves as prime factors, so all prime numbers are relatively prime to the others.


Why are prime numbers divisible?

Prime numbers are divisible because any numbers that are divisible are prime. If a number isn't divisible, it isn't prime. Prime numbers have to be divisible by at least one pair of numbers to be prime.


Are there infinitely many natural numbers that are not prime?

This can be an extension to the proof that there are infinitely many prime numbers. If there are infinitely many prime numbers, then there are also infinitely many PRODUCTS of prime numbers. Those numbers that are the product of 2 or more prime numbers are not prime numbers.


What 2 prime numbers 30?

No two prime numbers can make 30.No two prime numbers can make 30.No two prime numbers can make 30.No two prime numbers can make 30.


Does prime factorization of composite numbers include prime and composite numbers?

No, prime factorizations consist entirely of prime numbers.


How can prime numbers be used in your everyday life?

Prime numbers are used to find the LCM of numbers Prime numbers are used to find the HCF of numbers Prime numbers are used to simplify fractions Prime numbers are used to find the LCD of fractions


Are co-prime numbers and twin prime numbers the same?

No - co-prime numbers are pairs of numbers which share no positive integer factors apart from 1. Twin prime numbers are a pair of prime numbers with a difference of 2.


Do all prime numbers have prime factorization?

There is no need to do prime factorization as prime numbers are already prime.