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.
| Learn HTML | Learn PHP basics | Learn Advanced PHP | Learn SQL with MySQL | Installing an Apache server | Configuring an Apache server | Installing PHP and MySQL on Apache |
| 6 HTML tutorials | 8 PHP tutorials | 8 Advanced PHP tutorials | 6 MySQL tutorials | 4 Apache Installation tutorials | 5 Apache Configuration tutorials | 5 PHP/MySQL on Apache tutorials |
Moderators: shynthriir, SidT
void q2(int x){
int a,b;
for(a=1;a<=71;a++) //2*71^2 <= 10'000
for(b=a;b<=71;b++)
if (a*a+b*b==x)
printf("%d %d\n",a,b);
}#define N 10000
main() {
int i, j, t[N]={0,0,1};
for( i=3; i<N; i++ )
t[i]=2;
for( i=2; i<N; i++ )
for( j=i+1; j<N; j++ )
t[j] = (t[j]*i) % j;
for( i=0; i<N; i++ )
if(t[i])
printf("%d ", i); }Return to Algorithms and Data Structures
Registered users: Bing [Bot], Google [Bot]