This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract ProjectEuler001 { | |
// For the low price of 1000 wei, you can solve Project Euler Problem 1! | |
uint price = 1000; | |
event Solved(uint n, uint result); | |
// Returns the n-th triangular number 1 + 2 + ... + n | |
function t(uint n) private pure returns (uint) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float PHI = (1 + sqrt(5)) / 2; | |
void goldenSpiral(float h) { | |
// Base case: stop drawing if the height is too small. | |
if (h < 2) { | |
return; | |
} | |
// Draw bounding box and quarter circle. For some reason, using 2 * h - 1 | |
// looks better than using 2 * h. |
OlderNewer