Graeme's Home  
Graeme's Math Help
 Links 

Graeme's email

Search Engines
Kids' Stuff
Sports
Audio (StreamingRadio)
Music
Movies
How to Make a Home Page
Tools
Find a Host
Web Design
Advanced Techniques
Fun Sites to Explore
"Link of the Day"
Funnies
Home Pages
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
Advice, Tricks, and Screening
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 "<h2>Syntax</h2>" & vbNewLine
Response.Write "<p>To print the primes between 1 and 456, use"
Response.Write "<code><big><b>MathSamples.asp?n=456</b></big></code></p>" & vbNewLine
Response.Write "<h2>Output</h2>" & vbNewLine
Response.Write "<p>The primes between 1 and " & n & " are:" & vbNewLine & "<blockquote>" & vbNewLine
For i = 2 to n : If isPrime(i) Then : Response.Write i & " " : End If : Next
response.write vbNewLine & "</blockquote></p>" & 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, useMathSamples.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