Jump to content
View in the app

A better way to browse. Learn more.

Opusmodus

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Tom Johnson / Pascal's Triangle Modulo Seven ... and more

Featured Replies

here is a short program (based on JOHNSON's writing... pascal-code found in www and modified) to generate TOM JOHNSON's series of numbers for "pascal's triangle ...".

 

maybe interesting to play with the MODULO like JOHNSON did (mod 7)... try it!

 

greetings

andré

 

;;; SUB
(defun pascal-next-row (a &key (johnson-modulo nil))
    (loop :for q :in a
          :and p = 0 :then q
          :as s = (if (null johnson-modulo)
                    (list (+ p q))
                    (list (mod (+ p q) johnson-modulo)))
          :nconc s :into a
          :finally (rplacd s (list 1))
                  (return a)))
 
;;; MAIN
(defun pascal-triangle (n &key (johnson-modulo nil))
    (loop :for a = (list 1) :then (pascal-next-row a :johnson-modulo johnson-modulo)
          :repeat n
          :collect a))


;;; => pascal-triangle 
(pascal-triangle 7)
=> ((1) (1 1) (1 2 1) (1 3 3 1) (1 4 6 4 1) (1 5 10 10 5 1) (1 6 15 20 15 6 1))

;;; => pascal-triangle with MODULO like tom johnson in PASCAL'S TRIANGLE MODULO SEVEN
(pascal-triangle 21 :johnson-modulo 7)
=> ((1) (1 1) (1 2 1) (1 3 3 1) (1 4 6 4 1) (1 5 3 3 5 1) (1 6 1 6 1 6 1) (1 0 0 0 0 0 0 1) (1 1 0 0 0 0 0 1 1) (1 2 1 0 0 0 0 1 2 1) (1 3 3 1 0 0 0 1 3 3 1) (1 4 6 4 1 0 0 1 4 6 4 1) (1 5 3 3 5 1 0 1 5 3 3 5 1) (1 6 1 6 1 6 1 1 6 1 6 1 6 1) (1 0 0 0 0 0 0 2 0 0 0 0 0 0 1) (1 1 0 0 0 0 0 2 2 0 0 0 0 0 1 1) (1 2 1 0 0 0 0 2 4 2 0 0 0 0 1 2 1) (1 3 3 1 0 0 0 2 6 6 2 0 0 0 1 3 3 1) (1 4 6 4 1 0 0 2 1 5 1 2 0 0 1 4 6 4 1) (1 5 3 3 5 1 0 2 3 6 6 3 2 0 1 5 3 3 5 1) (1 6 1 6 1 6 1 2 5 2 5 2 5 2 1 6 1 6 1 6 1))

;;; look!!

(list-plot (flatten (pascal-triangle 50 :johnson-modulo 7))
           :point-radius 0 :style :fill)

(list-plot (flatten (pascal-triangle 50 :johnson-modulo 11))
           :point-radius 0 :style :fill)

(list-plot (flatten (pascal-triangle 80 :johnson-modulo 17))
           :point-radius 0 :style :fill)

(list-plot (flatten (pascal-triangle 50 :johnson-modulo 3))
           :point-radius 0 :style :fill)

;;; rnd-testing
(list-plot (flatten (pascal-triangle 80 :johnson-modulo (1+ (random 23))))
           :point-radius 0 :style :fill)

 

 

 

  • Author

listen to the processes...

 

(make-omn :pitch (integer-to-pitch (pascal-triangle 50 :johnson-modulo (1+ (random 23))))
          :length '(t)
          :span :pitch)

 

an example with parallel processes (chordized)..


(setf chordlist (loop 
                  for i in (flatten (integer-to-pitch (pascal-triangle 20 :johnson-modulo (1+ (random 23)))))
                  for j in (flatten (integer-to-pitch (pascal-triangle 20 :johnson-modulo (1+ (random 23)))))
                  for k in (flatten (integer-to-pitch (pascal-triangle 20 :johnson-modulo (1+ (random 23)))))
                  append (chordize (list i j k))))



(make-omn :pitch chordlist
          :length '(t)
          :span :pitch)

 

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.