genrfncs.icn: Procedures to generate sequences

procedure arandseq:        arithmetic sequence with random intervals
procedure arithseq:        arithmetic sequence
procedure beatty1seq:      Beatty sequence 1
procedure beatty2seq:      Beatty sequence 2
procedure catlnseq:        generalized Catalan sequence
procedure chaosseq:        Hofstadter's chaotic sequence
procedure connellseq:      generalized Connell sequence
procedure chexmorphseq:    sequence of centered hexamorphic numbers
procedure cfseq:           continued-fraction sequence
procedure eisseq:          EIS A sequence
procedure factseq:         factorial sequence
procedure fareyseq:        Farey fraction sequence
procedure fareydseq:       Farey fraction denominator sequence
procedure fareynseq:       Farey fraction numerator sequence
procedure fareyn1seq:      Farey fraction numerator sequence, 1-based
procedure fibseq:          generalized Fibonacci sequence
procedure fileseq:         sequence from file
procedure figurseq:        sequence of figurate numbers
procedure friendseq:       random friendly sequence
procedure geomseq:         geometric sequence
procedure hailseq:         hailstone sequence
procedure irepl:           repeated sequence
procedure linrecseq:       synonym for lrrcseq
procedure lrrcseq:         linear recurrence sequence
procedure meanderseq:      generate meandering characters
procedure mthueseq:        Morse-Thue sequence
procedure mthuegseq:       generalized Morse-Thue sequence
procedure multiseq:        sequence of repeated integers
procedure ngonalseq:       sequence of polygonal numbers
procedure nibonacciseq:    n-valued Fibonacci generalization
procedure partitseq:       sequence of integer partitions
procedure pellseq:         generalized Pell sequence
procedure perrinseq:       perrin sequence
procedure polyseq:         sequence of polynomial evaluations
procedure primeseq:        sequence of prime numbers
procedure powersofseq:     powers
procedure powerseq:        powers sequence
procedure rabbitseq:       rabbit sequence
procedure ratsseq:         reverse add and then sort sequence
procedure signaseq:        signature sequence
procedure spectseq:        spectral sequence
procedure srpseq:          generate square-root palindrome
procedure versumseq:       generalized reversed-sum sequence
procedure versumopseq:     versum sequence with operator
procedure vishwanathseq:   random variation on Fibonacci sequence
procedure zebra:           black and white bands

link genrfncs
March 4, 2003; Ralph E. Griswold
Requires: co-expressions
This file is in the public domain.

These procedures generate sequences of results.

arandseq(i, j)       arithmetic sequence starting at i with randomly
                     chosen increment between 1 and j

arithseq(i, j)       arithmetic sequence starting at i with increment j

beatty1seq()         Beatty's first sequence i * &phi

beatty2seq()         Beatty's second sequence i * &phi ^ 2

catlnseq(i)          sequence of generalized Catalan numbers

cfseq(i, j)          continued-fraction sequence for i / j

chaosseq()           chaotic sequence

chexmorphseq()       sequence of centered hexamorphic numbers

connellseq(p)        generalized Connell sequence

dietzseq(s)          Dietz sequence for polynomial

dressseq(i)          dress sequence with increment i, default 1 (Schroeder)

eisseq(i)            EIS A sequence for i

factseq()            factorial sequence

fareyseq(i, k)       Farey fraction sequence; k = 0, the default, produces
                     numerator sequence; k = 1 produces denominator
                     sequence

fibseq(i, j, k, m)   generalized Fibonacci sequence (Lucas sequence)
                     with initial values i and j and additive constant
                     k.  If m is supplied, the results are produced
                     mod m.

figurseq(i)          series of ith figurate number

fileseq(s, i)        generate from file s; if i is null, lines are generated.
                     Otherwise characters, except line terminators.

friendseq(k)         generate random friendly sequence from k values, 1 to k
                     (in a friendly sequence, successive terms differ by 1).


geomseq(i, j)        geometric sequence starting at i with multiplier j

hailseq(i)           hailstone sequence starting at i

irepl(i, j)          j instances of i

lindseq(f, i)        generate symbols from L-system in file f; i if
                     present overrides the number of generations specified
                     in the L-system.

logmapseq(k, x)      logistic map

lrrcseq(L1, L2)
                     generalized linear recurrence with constant
                     coefficients; L1 is a list of initial terms,
                     L2 is a list of coefficients for n previous values,
                     where n = *L2

meanderseq(s, n)     sequences of all characters that contain all n-tuples
                     of characters from s

mthueseq()           Morse-Thue sequence

mthuegseq(i)         Morse-Thue sequence for base i

multiseq(i, j, k)    sequence of (i * j + k) i's

ngonalseq(i)         sequence of the ith polygonal number

nibonacciseq(values[])
                     generalized Fibonacci sequence that sums the
                     previous n terms, where n = *values.

partitseq(i, j, k)   sequence of integer partitions of i with minimum j
                     and maximum k

pellseq(i, j, k)     generalized Pell's sequence starting with i, j and
                     using multiplier k

perrinseq()          Perrin sequence

polyseq(coeff[])     polynomial in x evaluated for x := seq()

primeseq()           the sequence of prime numbers

powerseq(i)          sequence n ^ i, n = 1, 2, 3, 4, ...

powersofseq(i)       sequence i ^ n, n = 1, 2, 3, 4, ...n

rabbitseq()          rabbit sequence

ratsseq(i)           versumseq() with sort

signaseq(r)          signature sequence of r

spectseq(r)          spectral sequence integer(i * r), i - 1, 2, 3, ...

srpseq(n, m)         palindromic part of the continued-fraction sequence
                     for sqrt(n^2+m)

versumseq(i, j)      generalized sequence of added reversed integers with
                     seed i (default 196) and increment j (default 0)

versumopseq(i, p)    procedure p (default 1) applied to versumseq(i)

vishwanathseq()      random variation on Fibonacci sequence

zebra(values[])      zebra colors, alternating 2 and 1, for number of
                     times given by successive values

Source code | Program Library Page | Icon Home Page