Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,5 +1,3 @@
import std.stdio, std.algorithm, std.range;
bool isHappy(int n) pure nothrow {
int[int] past;
@ -19,5 +17,7 @@ bool isHappy(int n) pure nothrow {
}
void main() {
int.max.iota().filter!isHappy().take(8).writeln();
import std.stdio, std.algorithm, std.range;
int.max.iota.filter!isHappy.take(8).writeln;
}

View file

@ -1,10 +1,10 @@
import std.stdio, std.algorithm, std.range, std.conv;
import std.stdio, std.algorithm, std.range, std.conv, std.string;
bool isHappy(int n) pure /*nothrow*/ {
bool isHappy(int n) pure nothrow {
int[int] seen;
while (true) {
immutable t = n.text.map!q{(a - '0') ^^ 2}.sum;
immutable t = n.text.representation.map!q{(a - '0') ^^ 2}.sum;
if (t == 1)
return true;
if (t in seen)