Advertisement
lavalamp

Euler 173

Oct 23rd, 2014
2,794
0
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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement