juhuu

got it

ist zwar nicht sauber, aber mir ist es zu spät, dass in ne saubere rekursion umzusetzen

quick n dirty

in php
Code:
<?php
ini_set('memory_limit', '2048M');
class lol {
private $str = '1';
private $pos = 0;
private $count = 1;
private $newstr = '';
private $i = 0;
public function __construct() {
$this->check(0);
}
private function check() {
$char = $this->str[$this->pos];
while($this->checkNext($char,$this->pos + $this->count)) $this->count++;
$this->newstr .= $this->count . $char;
$this->pos += $this->count;
$this->count = 1;
if ($this->pos >= strlen($this->str)) {
$this->i++;
echo "run {$this->i} [length: ". strlen($this->newstr) ."]\n";
echo $this->str = $this->newstr;
echo "\n";
if ($this->i >= 30) die();
$this->newstr = '';
$this->pos = 0;
}
$this->check();
}
private function checkNext($char,$pos) {
if (!isset($this->str[$pos])) return false;
if ($char === $this->str[$pos]) return true;
return false;
}
}
new lol();
?> hatte erst bis 50 in erinnerung undmich gefragt, wieso soviel speicher drauf geht

daher das memory limit ;D
dann is mir eingefallen, das das php 32bit ist und daher recht schnell versagt....
-> und zwar genau beim 50ten run, aber mehr als 2gb kann ich dem php ja nicht geben...
Code:
run 49 [length: 894810]
Code:
PHP Fatal error: Out of memory (allocated 2009333760) (tried to allocate 261900 bytes) in D:\coding\zahlenreihe.php on line 37
Fatal error: Out of memory (allocated 2009333760) (tried to allocate 261900 bytes) in D:\coding\zahlenreihe.php on line 37
own3d ;D
ansonst das erg: