Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Cobol/verschiedene-Autoren/Jens/   (Columbo Version 0.7©)  Datei vom 4.1.2008 mit Größe 1 kB image not shown  

Quelle  collatz.cob   Sprache: Cobol

 
       identification division.
       program-id. collatz.
      * das Collatz-Problem aus Wikipedia
      * auch als Ulam-Problem bekannt
      * und aus Mäder "Mathematik für ..."
       author"JD".
       date-written. 22.9.2006.
       date-compiled.
       data division.
       working-storage section.
         77 m   pic 9(4).
         77 k   pic 9(4).
       linkage section.
         77 n   pic 9(4).
       procedure division using n.
         evaluate function mod(n,4)
         when 0 
           divide 4 into n
         when 1
           compute n = 3*n+1
           evaluate function mod(n,4)
           when 0
             divide 4 into n
           when 1
             compute n = 3*n+1
             evaluate function mod(n,4)
             when 0
               divide 4 into n
             when 1
               compute n = 3*n+1
             when 2
               divide 2 into n
             when 3
               compute n = 3*n+1
            end-evaluate  
           when 2
             divide 2 into n
           when 3
             compute n = 3*n+1
           end-evaluate
         when 2
           divide 2 into n
         when 3
             compute n = 3*n+1
             evaluate function mod(n,4)
             when 0
               divide 4 into n
             when 1
               compute n = 3*n+1
             when 2
               divide 2 into n
             when 3
               compute n = 3*n+1
            end-evaluate  
         end-evaluate  
         display "done".
         stop run.
        end-program collatz.

Messung V0.5
C=93 H=95 G=93

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.