Graeme's Home   Graeme's Math Help
 Graeme's email
Search Engines
Kids' Stuff
Sports
Music
Movies
Tools
Find a Host
Web Design
Fun Sites to Explore
Funnies
Job, Career
Colleges, Education
Food
Running
Information Sources
The BibleLanguage
For School Reports

e-Books, Catalogs
Math, Science, Philosophy
High School Reunion
Financial / Investment Info
Banks
Brokers, Exchanges
Stock Prices, News
Web Publishers
Newspapers
Television Networks
Technical Journals
Web-Zines
Financial Magazines
Retailers
Consumer Guides
Books, etc.
Computer
Auctions, Other
Shipping
Local Guide
Restaurants
Travel
Airlines
Discount Tickets
Computers
vi, ASP, JavaScript
Consulting
Software Windows

Hardware Vendors
IBM Mainframe, AS/400
Training
 ```<% n = Request.Querystring("n") If n < 100 Then : n = 100 : End If If n > 10000 Then : n = 10000 : End If Response.Write "

Syntax

" & vbNewLine Response.Write "

To print the primes between 1 and 456, use" Response.Write "MathSamples.asp?n=456

" & vbNewLine Response.Write "

Output

" & vbNewLine Response.Write "

The primes between 1 and " & n & " are:" & vbNewLine & "

" & vbNewLine For i = 2 to n : If isPrime(i) Then : Response.Write i & " " : End If : Next response.write vbNewLine & "

" & vbNewLine Function isPrime(i)    For j = 2 To Sqr(i)       If (i\j)*j = i Then : isPrime=vbFalse : Exit Function : End If       Next    isPrime=vbTrue    Exit Function End Function %>```

## Syntax

To print the primes between 1 and 456, use`MathSamples.asp?n=456`

## Output

The primes between 1 and 100 are:

2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97