@Tin_Tin: You need not do a search from y to x in order to test for primality. y to x / 2 would be sufficient (if q is very large, you may need to google for more efficient deterministic or probabilistic algos). Also, there's a bug that limits the output to the first two factors of the first composite number. =)
[ simon.cpu ]



 
			
			 
			
 Re: C/C++ i need help in making a program
 Re: C/C++ i need help in making a program
				 
       
					
					
					
						 Reply With Quote
  Reply With Quote Originally Posted by simoncpu
 Originally Posted by simoncpu 
					
				 and another thing... altho naa ang solution, but much better if it's fast and efficient
 and another thing... altho naa ang solution, but much better if it's fast and efficient 
			 
			 
			 
			 
			
