Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. //Check if there is a natural number i
  2. //by which t can be divided without rest
  3.  
  4. //This code should only executed if it has been determined above that ((t - 1) % 3 == 0) is false
  5.  
  6. int matchFound=0;
  7. int i=1;
  8.  
  9. while (i*i <= t) { //Go through all natural numbers from 1 onwards
  10. //until i gets "too large"
  11.  
  12. if (i*i == t) matchFound=1; //If there is a natural number i that multiplied with itself is t,
  13. //t has an integer square root and is part of the function t=n²
  14.  
  15. i++; //Don't forget to actually count up!
  16. }
  17.  
  18. return matchFound; //returns 1 if t is part of the function t=n², 0 if not
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement