Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- void main()
- {
- ulong p = 1;
- ulong n = 2;
- ulong sum = 0;
- ulong temp;
- while (n < 4e9)
- {
- sum += n;
- temp = p + 2*n;
- n = 2*p + 3*n;
- p = temp;;
- }
- writeln(sum);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement