AlgNet/GeoNet: A Union City School District Summer Enrichment Program
Using technology not simply to do things better, but to do better things.

PROGRAM PRIMES

This program displays a list of prime numbers. The user is prompted to enter a vslue that represents the largest prime number.
PROGRAM:PRIMES

:ClrHome
:Disp "LAST PRIME"
:Input V
:1->dim(L6)
:2->L6(1)
:Disp 2
:For(N,3,V,2)
:1->P
:1->I
:While P and (I<=dim(L6))
:1(N/L6(I))=int(N/L6(I))->P
:1+I->I
:End
:If P
:Then
:Disp N
:N->L6(dim(L6)+1)
:End
:End

Notes:

  1. This program fills a list with the prime values it finds.
  2. It makes use of a BOOLEAN operator (True or False) for the loop control.

Return to Programming the TI-83
THE MATH FORUM: Creating community, developing resources, constructing knowledge...