Way to Go, Adam!
The broadcast star of the future just might be on the airwaves in our area today.
via wvgazette.com
http://post.ly Is Cool, Nice Job @posterous!
A Java + Iterate Solution to Project Euler Problem 6
A friend of mine posted his Groovy solution to Project Euler Problem #6, so I figured I’d post a Java solution. Here it is using Iterate (note that the second parameter of range()
is the exclusive upper bound):
square().apply(each(range(1, 101)).reduce(sum())) - each(range(1, 101)).map(square()).reduce(sum());
And a nicer version using an upcoming release of Iterate:
square().apply(range(1, 101).reduce(sum())) - range(1, 101).map(square()).reduce(sum());
And here’s a straight Java version for comparison:
int sum = 0;
int sumOfSquares = 0;
for(int i=1; i<=100; i++) {
sum += i;
sumOfSquares += i * i;
}
int answer = (sum * sum) - sumOfSquares;
Tropical Jeep
[[posterous-content:TgIpBXy9mlRiMQC2JwYW]]
My Parents Bought Us the Sign We Saw at a Diner a While Back
[[posterous-content:F9P0GozPiR3db08HXH94]]
Our Neighbor Bought Us Mugs From Disney in Return for Dog-sitting Their German Shepherd
[[posterous-content:QqQNjuK8i9Fo5OtLS5nS]]
Cleaned, Lubed, an Adjusted the Mechanism on My Antique Desk Chair
[[posterous-content:cAKwK1lyWQglJww3bOZ1]]
THanks!
[[posterous-content:nWKFudHLg72IsQNTAiAg]]
Windgate Chambourcin
[[posterous-content:0CpL3VCqbXdOhEGBhKvG]]
A Christmas gift from Lor’s brother.