This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -6,7 +6,6 @@ function happy([int] $n) {
while( $hist[$sum] -eq $null ) {
if($sum -eq 1) {
$a+=$i
$i
}
$hist[$sum]=$sum
$sum2=0
@ -17,4 +16,5 @@ function happy([int] $n) {
$sum=$sum2
}
}
$a -join ','
}

View file

@ -1,18 +1,2 @@
function happy([int] $n) {
1..$n | ForEach-Object {
$sum=$_
$hist=@{}
while( $hist[$sum] -eq $null ) {
if($sum -eq 1) {
$_
}
$hist[$sum]=$sum
$sum2=0
foreach($j in $sum.ToString().ToCharArray()) {
$k=([int]$j)-0x30
$sum2+=$k*$k
}
$sum=$sum2
}
}
}
happy(8)
7,10,13,19,23,28,31,32