How can I find/program a list of:
We only operate with natural numbers.
1. The prime numbers < 10 000
2. x = a^2 + b^2 < 10 000
3. x = a^3 + b^3 < 10 000
4. x = a^2 + b^2 + c^2 < 10 000
5. x = a^3 + b^3 + c^3 < 10 000
Thank you.
2 replies to this topic
#1
Posted 27 November 2010 - 07:17 AM
|
|
|
#2
Posted 27 November 2010 - 08:04 AM
1)
Do you have any code allready?
If not:
Do you know how to code it for a single number?
2)
If you understand what's happening in #2. 3, 4 and 5 should be no problem. (especially not 3 )
Do you have any code allready?
If not:
Do you know how to code it for a single number?
2)
int x=0, a=0, b=0;
while(x<10000){
while(x<10000){
x = (int) (java.lang.Math.pow(a,2) + java.lang.Math.pow(b,2));
if(x<10000)
System.out.println(x +" = " + a +"^2 + "+ b++ +"^2");
}
b=0;
a++;
x=(int) (java.lang.Math.pow(a,2));
}
If you understand what's happening in #2. 3, 4 and 5 should be no problem. (especially not 3 )
#3
Posted 27 November 2010 - 10:36 AM
Thanks for your respons!
I dont have the code already.
Now I will try your code i Blue J Java.
I dont have the code already.
Now I will try your code i Blue J Java.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









