# Search the Community

Showing results for tags 'collatz'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• Welcome to Opusmodus
• Announcements
• Pre Sales Questions
• Support Forum
• Support & Troubleshooting
• OMN Lingo
• Function Examples
• Score and Notation
• Live Coding Instrument
• Library Setup
• MIDI Setup
• SuperCollider
• Suggestions & Ideas
• Zoom into Opusmodus
• Sharing
• User Extensions Source Code
• Opusmodus Network
• Meet, Compose, Collaborate
• Strategies and Methods to Control Complexity
• Opusmodus Workshops & Schools
• Composer Workshop

### Calendars

• Community Calendar

• Opusmodus

### Categories

• Tutorials
• How-to in 100 sec
• How-To
• Zoom into Opusmodus
• SuperCollider
• Workflow
• Live Coding
• Presentation
• Analysis
• Composer Workshop

• 0 Replies

• 0 Reviews

• 0 Views

Found 1 result

1. ## collatz => gen-sequence + collatz-transition

https://en.wikipedia.org/wiki/Collatz_conjecture ;;experiment with COLLATZ-conjecture ;;https://en.wikipedia.org/wiki/Collatz_conjecture (defun collatz (start-value number-of-value) (loop repeat number-of-value with value = start-value when (evenp value) do (setq value (/ value 2)) else do (setq value (+ (* 3 value) 1)) collect value)) (list-plot (collatz 15 20) :zero-based t :point-radius 2 :join-points t) ;;;;;;;;;;;; ;;same function like fibonacci-transition but now with COLLATZ. ;;don't know if that makes sense - just a bit code :-) (defun transition-with-collatz (number-of-values start-val value-a value-b) (let ((coll-length) (coll-seq) (all-seq)) (setq coll-length (loop for cnt = 1 then (incf cnt) collect (sum (collatz start-val cnt)) into bag when (> (car (last bag)) number-of-values) do (return (1- (length bag)))) coll-seq (collatz start-val coll-length) all-seq (append (reverse coll-seq) (loop repeat (- number-of-values (sum coll-seq)) collect 1))) (loop for i in all-seq append (loop repeat i for cnt = 0 then (incf cnt) when (= cnt 0) collect value-b else collect value-a)))) ;;example-1 => only the process => makes sense when using a lot of values... (list-plot (transition-with-collatz 500 56 1 2) :zero-based t :point-radius 2 :join-points t)
×
• #### Browser

• Video Gallery

• Lessons