A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Koh Khai Huat
Joined: Aug 05, 2005
Aug 05, 2005 05:04:00
Hi guys if any one knows how to create a program with
to calculate Prime numbers???
author and iconoclast
Joined: Jul 08, 2003
Aug 05, 2005 05:42:00
And again, this JavaRanch forum is for discussing JavaRanch itself. We've got other forums for discussing Java programming and other topics.
is for beginning Java questions; I'll move this post there for you.
[Jess in Action]
Niyas Ahmed Sheikh
Joined: Jun 15, 2005
Aug 05, 2005 05:55:00
May be helpful....
Joined: Dec 06, 2001
Aug 05, 2005 19:48:00
Can you be more specific? In particular, do you need to generate prime numbers or do you need to determine if a given number is prime. One simple approach to the former is
for i = 1 to n if i is prime print i
(Note this is pseudocode so it will not compile in Java directly.)
This relies on determining that a given number is prime. I'll leave this to you to figure out with some hints:
1) What does it mean for a number to be prime?
2) How can you determine if a number is NOT prime?
If you can come up with answers to these two questions, that would be a good starting place. Feel free to discuss your ideas here and we will be glad to help out.
Java API Documentation
The Java Tutorial
Joined: Jul 31, 2003
Aug 08, 2005 11:05:00
Probably more than you wanted to
Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
It is sorta covered in the
JavaRanch Style Guide
subject: Prime Numbers
Find 127th twin-prime pair?
Java Code puzzle
So just how MUCH must they know?
generating numbers from 1 to 100 to store in an array
Returning if a number is prime. (Chapter on Objects and classes. OOP)
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014