SHARE
TWEET

Euler 173

lavalamp Oct 23rd, 2014 291 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2.  
  3. t = 1000000;    \\ tiles
  4.  
  5. xlow = floor(sqrt(t));
  6. xhigh = floor(t/4)+1;
  7.  
  8. s = floor((xlow-1)/2);
  9. s *= (s+1);     \\ running total
  10.  
  11. x2 = xlow*xlow;
  12.  
  13. for(x=xlow+1,xhigh,
  14.        
  15.         x2 += x+x-1;
  16.        
  17.         s += floor((x - ceil(sqrt(x2-t)))/2);
  18.        
  19. );
  20.  
  21. print(s);
  22.  
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top