Einzelnen Beitrag anzeigen
Alt 09.11.09, 01:56   #12 (permalink)
easteregg
Member of Honour
 
Benutzerbild von easteregg
 
Registriert seit: 14.09.07
easteregg Leistung: Pentium Ieasteregg Leistung: Pentium I
easteregg eine Nachricht über ICQ schicken
Likes: 62
Standard

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:

erg   

Code:
run 30 [length: 5808]
132113213221133112132123123112111311222112132113311213211231232112311311222112111312211311123113322112132113212231121113112221121321132132211231232112311321322112311311222113111231133221121113122113121113221112131221123113111231121
123222112132113213221133122112231131122211211131221131112311332211213211321322113311213212322211231232112311321322112311311222113311213212322211231131122211311123113321112131221123113111231121123222112111312211312111322212321121113
122113221113122112132113121113222112311311221112131221123113112211322112211213322112132113213221133112132123123112111312111312212231131122211311123113322112111312211312111322111213122112311311123112112322211213211321322113311213212
312311211131122211213211331121321122112133221123123211231132132211231131122211331121321232221123113112221131112311322311211131122211213211331121321122112133221123113112221131112311332111213122112311311123112111331121113122112132113
121113222112311311221112131221123113112211322112211213322112111312211312111322212321121113121112131112132112311321322112111312211312111322211322111312211312111322211213211321322123211211131211121332211231131122211311122122111312211
213211312111322211231131122211311122113222123122113222122211211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113111231133221121321132122311211131122211213211321322112312321123113213221
123113112221131112311332211211131221131211221321123113213221121113122113121113222123113221132122212231131122211311123113321112131221123113111231121113311211131221121321131211132221123113112211121312211231131122113221122112133221121
113122113121113222123211211131211121311121321123113213221121113122113121113222113221113122113121113222112132113213221232112111312111213322112311311222113111221221113122112132113121113222112311311222113111221132221231221132221222112
112322211211131221131211132221232112111312111213111213211231132132211211131221232112111312211213111213122112132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211132221121311121312211213211312111
322211213211321322113311213212322211231131122211311123113223112111311222112132113311213211221121332211211131221131211132221231122212213211321322112311311222113311213212322211211131221131211132221231132212312311211132132212312211322
212221121123222112132113213221133112132123123112111311222112132113311213211231232112311311222112111312211311123113322112132113212231121113112221121321132132211231232112311321322112311311222113111231133221121113122113121113221112131
221123113111231121123222112132113213221133112132123123112111311222112132113311213211221121332211322132113213221133112132123123112111311222112132113311213211221121332211231131122211311123113321112131221123113112221132231131122211211
131221131112311332211213211321223112111311222112132113212221132221222112112322211211131221131211132221232112111312111213111213211231131112311311221122132113213221133112132123222112311311222113111231132231121113112221121321133112132
112211213322112111312211312111322212321121113121112131112132112311311222113221321123123211231131122211211131221133112132113221321123113121113221112131122211332113221122112133221123113112221131112311332111213122112311311123112111331
121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112212211131221121321131211132221123113112221131112311332211211133112111311222
112111312211311123113322112111312211312111322212321121113121112133221121321132132211331121321132213211231132132211211131221232112111312212221121123222112311311222113111231133211121321321122111312211312111322211213211321322123211211
131211121332211231131122211311123113321112131221123113111231121123222112111331121113112221121113122113111231133221121113122113121113221112131221123113111231121123222112111312211312111322212321121113121112131112132112311321322112111
312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211231131122211311123113
321112131221123113111231121113311211131221121321133112132113212221221113122113121113222123211211131211121332211213211321322113311213211322132112311321322112111312212321121113122122211211232221123113112221131112311332111213122112311
311123112111331121113122112132113121113222112311311221112131221123113112211322112211213322112111331121113112221121113122113111231133221121113122113121113221112131221123113111231121123222112111312211312111322212321121113122113221113
122112132113121113222112311311221112131221123113112211322112211213322112111312211312111322212321121113121112131112132112311321322112111312212321121113122112131112131221121321132132211231131122211331121321232221121113122113121122132
112311321322112111312211312113221133211322112211213322112132113213221133112132123123112111311222112132113311213211231232112311311222112111312211311123113322112132113212231121113112221121321132132211231232112311321322112311311222113
111231133221121113122113121113221112131221123113111231121123222112132113213221133112132123123112111312111312212231131122211311123113322112111312211312111322111213122112311311123112112322211211131221131211132221232112111312111213111
213211231131122211322132112312321123113112211322112211213322112111312211312111322212321121113121112133221132213211321322113311213212312311211131122211213211331121321122112133221123113112221131112311332111213122112311311123112111331
121113122112132113121113222112311311222113111221221113122112132113121113222112132113213221133122211332111213322112132113213221132231131122211311123113322112111312211312111322212321121113122123211231131122113221123113221113122112132
113213211121332212311322113212221
__________________
» Flattr mich! - Wenn dir mein Beitrag geholfen hat! «
<| 2 AMD Opterons 2384@ 8x3,2ghz | Tyan S2915 | 10GB | 2x 8800GT | 8400GS | Dell 3008WFP + 2x2007FP |>
easteregg ist offline   Mit Zitat antworten
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61