We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #153: Investigating Gaussian Integers
Project Euler #153: Investigating Gaussian Integers
Sort by
recency
|
7 Discussions
|
Please Login in order to post a comment
I think that I have got right logic, but it reports compile time out. Can anyone guide me?
include
include
include
define max 1000000
using namespace std; int num,gsn=0; int *fact = new int[max];
int factorize_real(int); void square_sum(int,int);
int main(){ int loop=2,count; cin>>num; if(num!=1){ while(loop<=num){ count = factorize_real(loop); /* now fact[] has all real factors of the input number from 0 to count-1 for all x+iy a complex number to be a guassian divisor ((x^2)+(y^2)) should belong to fact[] for this we are using square_sum(n) */ square_sum(loop,count); loop++; } gsn++;//to add for one cout<
} else{ gsn=1; cout<
} delete [] fact; return 0; }
int factorize_real(int num){ //gives real factors of an integer number int count=2; int i=2,j=1,end; int *front = new int[max]; int *back = new int[max]; end=num; front[0]=1; back[0]=num;
}
void square_sum(int n,int count){
}
Can anyone tell me the correct solution for input = 1000?
i think my logic is right..just it is taking more time...please someone help :( .............................. import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
}
hi can anybody tell me the application for this question in real live projects.
Hi guys,
would anybody be so nice to explain to me, how 2+2i is a divisor of 4. My result is
(4*(2-2i)) / 8
Which shouldn't be a divisor if I understood everything correctly.
Thanks in advance.