Posh Challenge Part 9
Level 10,
This one was easy as I knew the answer to the sequence so could just look how to script it, still was a nice exercise, ( can you solve the Sequence's logic by only looking at the PowerShell script ? ) :
you had to fill on this Sequence till 30 and then get the length for the solution :
a = [1, 11, 21, 1211, 111221,
If you did not need read The Cuckoo's Egg ( you should ) you can find some info here , FAQ about Morris Number Sequence , my implementation of a generator for this Sequence in PowerShell :
<?xml version="1.0"?>
# Morris
$a = @(1)
0..30 |% {
$l=0;$c=0;$s=''
([char[]]"$($a[$_])")+0 |% {
if ($_ -eq $l) {
$c++
} else {
if ($l -ne 0) {$s += "$c$l"}
$c=1;$l=$_
}
}
$a += $s
}
# Solution
$IE = New-Object -Com Internetexplorer.Application
$IE.Navigate("http://www.pythonchallenge.com/pc/return/$($a[30].length).html")
$IE.Visible = $TRUE
What brings us more bitmap fun from PowerShell in next post about Level 11 .
Enjoy,
Greetings /\/\o\/\/