Post Reply 
(49g 50g) WEIGH Transform
11-24-2019, 10:12 PM
Post: #1
(49g 50g) WEIGH Transform
This program computes the WEIGH transform of a sequence of integers. Some information here.

The program requires the ListExt Library and must be run in exact mode. This is a very computationally intensive program- use of an emulator is recommended, especially for longer lists.

Code:

\<< DUP SIZE R\->I \-> b n
  \<< 1 b HEAD 2. \->LIST 2 n
    FOR j b HEAD SWAP 2 j
      FOR k k DIVIS b OVER LPICK OVER * SWAP REV 1 ADD 1.
        \<< I\->R 2. MOD { -1 } { 1 } IFTE
        \>> DOLIST * LSUM SWAP
      NEXT j 1 + ROLLD j \->LIST OVER REV * LSUM j / +
    NEXT
  \>>
\>>
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)