RosettaCodeData/Task/Generator-Exponential/D/generator-exponential-2.d

13 lines
305 B
D
Raw Permalink Normal View History

2013-10-27 22:24:23 +00:00
void main() {
import std.stdio, std.bigint, std.range, std.algorithm;
2013-04-10 21:29:02 -07:00
2013-10-27 22:24:23 +00:00
auto squares = 0.sequence!"n".map!(i => i.BigInt ^^ 2);
auto cubes = 0.sequence!"n".map!(i => i.BigInt ^^ 3);
2013-04-10 21:29:02 -07:00
2013-10-27 22:24:23 +00:00
squares
.filter!(s => cubes.find!(c => c >= s).front != s)
.drop(20)
.take(10)
.writeln;
2013-04-10 21:29:02 -07:00
}