rivers-0.1.0: Rivers are like Streams, but different.

Portabilityprobably portable
Stabilityexperimental
Maintainerdrewday@gmail.com

Data.Rivers.Ecology

Contents

Description

This module is an attempt to construct many and varied examples of Rivers and Streams. At the moment, the concept of what Rivers are (or are not) is not entirely clear in the mind of any particular person on Earth, myself foremost amoung the befuddled.

Primarily because I lay claim to inventing the idea, this is a worrisome situation. Nevertheless, whatever these things are, regular old Data.Stream streams (and kin) are subsets (or sub-classes, or.. sub-something) of these things, and hence they must qualify to be mapped in this ecosystem (by definition).

As of now, these example originate primarily from three excellent papers on Streams and their properties. More precisey, they originate from my haphazard and occasionally mindless transcription of what I saw from these documents. Therefore, the authors of the following papers deserve much of the credit, but bear none of the responsibility of the contents of this module.

CONTRACTIVE
PEARL-UFP
PROVING-UFP

This module should clearly document the behavior of all functions. In fact, the code in this module is generally not intended to be imported and used directly. Instead the purpose of this module is to:

  1. show *many* examples of Streams, especially non-trivial ones (ie, more complicated than fibionacci)
  2. provide visual (and eventually, pictoral) *proof* of equality (insofar that this is possible)
  3. ... more things
  4. ... should go here
  5. ... becuase there's a point to all of this, right?

Note: To accomidate the documentation, the text-width of this document is 129 characters.

As a witness to the correctness of the examples, I include the result of running doctest:

 $ doctest Data/Rivers/Ecology.hs
 Cases: 74  Tried: 74  Errors: 0  Failures: 0

Synopsis

Silly Streams

Constant Zeroes

sZero :: S IntegerSource

>>> stake 30 $ sZero
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

gZero :: G Integer IntegerSource

>>> stake 30 $ fwdFix gZero
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

rZero :: G Integer IntegerSource

>>> stake 30 $ revFix rZero
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

cZero :: S IntegerSource

>>> stake 30 $ cZero
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

cZeroH :: Num a => ([a], Int) -> aSource

cZeroT :: Num t => ([a], t) -> a -> ([a], t)Source

Constant Ones

sOne :: S IntegerSource

Believe it or not, this is in OEIS:

>>> take 30 $ fromOEIS "A000012"
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
>>> stake 30 $ sOne
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]

sOnes :: S IntegerSource

>>> stake 30 $ sOnes
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]

gOne' :: G Integer IntegerSource

>>> stake 30 $ fwdFix gOne
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]

rOne :: G Integer IntegerSource

>>> stake 30 $ revFix rOne
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]

cOne :: S IntegerSource

>>> stake 30 $ cOne
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]

cOneH :: t -> tSource

cOneT :: t -> t -> tSource

The Natural Numbers

sNat :: S IntegerSource

>>> take 30 $ fromOEIS "A000027"
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
>>> stake 30 $ sNat
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]

sNatIt :: S IntegerSource

>>> stake 30 $ siterate (+1) 0
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]

natnat :: S IntegerSource

>>> stake 30 $ natnat
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]

gNat' :: [a] -> IntSource

>>> stake 30 $ fwdFix gNat
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]

rNat :: G Integer IntegerSource

>>> stake 30 $ revFix rNat
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]

cNat :: S IntegerSource

>>> stake 30 $ cNat
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]

cNatH :: t -> tSource

cNatT :: Num a => a -> t -> aSource

Natural Numbers from Binary

bin :: S IntegerSource

>>> stake 30 $ bin
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]

Simple Streams

Power Streams

Powers of (-2)

revPowersOfN2 :: S IntegerSource

>>> take 15 $ fromOEIS "A122803"
[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384]
>>> stake 15 $ revPowersOfN2
[1,-2,4,-8,16,-32,64,-128,256,-512,1024,-2048,4096,-8192,16384]

Powers of (2) - Bool

pot :: S BoolSource

>>> stake 15 $ pot
[True,True,False,True,False,False,False,True,False,False,False,False,False,False,False]

Powers of (3)

revPowersOf3 :: S IntegerSource

>>> take 15 $ fromOEIS "A000244"
[1,3,9,27,81,243,729,2187,6561,19683,59049,177147,531441,1594323,4782969]
>>> stake 15 $ revPowersOf3
[1,3,9,27,81,243,729,2187,6561,19683,59049,177147,531441,1594323,4782969]

Squares

a000290 :: S IntegerSource

>>> take 30 $ fromOEIS "A000290"
[0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400,441,484,529,576,625,676,729,784,841]
>>> stake 30 $ bsum $ 2 * sNat + 1
[0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400,441,484,529,576,625,676,729,784,841]

Factorial Numbers

sFac :: S IntegerSource

>>> take 10 $ fromOEIS "A000142"
[1,1,2,6,24,120,720,5040,40320,362880]
>>> stake 10 $ sFac
[1,1,2,6,24,120,720,5040,40320,362880]

The Family of Fibionacci (and Lucas!)

Forever Fibionacci

sFib :: S IntegerSource

>>> take 29 $ fromOEIS "A000045"
[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811]
>>> stake 29 $ sFib
[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811]

sFib2 :: S IntegerSource

>>> stake 29 $ sFib2
[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811]

revGfibs :: G Integer IntegerSource

>>> stake 29 $ revFix revGfibs
[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811]

cFibH :: (a, b) -> aSource

cFibT :: Num a => (a, a) -> a -> (a, a)Source

>>> stake 29 $ cFib
[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811]

gFibs :: G Integer IntegerSource

>>> stake 29 $ fwdFix gFibs
[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811]

Lonely Lucas

sLucas :: S IntegerSource

>>> take 28 $ fromOEIS "A000032"
[2,1,3,4,7,11,18,29,47,76,123,199,322,521,843,1364,2207,3571,5778,9349,15127,24476,39603,64079,103682,167761,271443,439204]
>>> stake 28 $ sLucas
[2,1,3,4,7,11,18,29,47,76,123,199,322,521,843,1364,2207,3571,5778,9349,15127,24476,39603,64079,103682,167761,271443,439204]

rLucas :: G Integer IntegerSource

>>> stake 28 $ revFix rLucas
[2,1,3,4,7,11,18,29,47,76,123,199,322,521,843,1364,2207,3571,5778,9349,15127,24476,39603,64079,103682,167761,271443,439204]

under (4*n + 1)

fib4np1 :: S IntegerSource

The Fibionacci (4n + 1) and Lucas (4n + 1) numbers

drop0L is evidently a bisect twice function

>>> stake 10 $ drop0L sFib
[1,5,34,233,1597,10946,75025,514229,3524578,24157817]
>>> take 10 $ fromOEIS "A033889"
[1,5,34,233,1597,10946,75025,514229,3524578,24157817]

luc4np1 :: S IntegerSource

>>> stake 10 $ drop0L sLucas
[1,11,76,521,3571,24476,167761,1149851,7881196,54018521]
>>> take 10 $ fromOEIS "A056914"
[1,11,76,521,3571,24476,167761,1149851,7881196,54018521]

under (2*n)

fib2n :: S IntegerSource

The Fib (2*n) and Lucas (2*n) numbers

dromIp1L is evidently a bisect function

>>> stake 20 $ dropIp1L sFib
[0,1,3,8,21,55,144,377,987,2584,6765,17711,46368,121393,317811,832040,2178309,5702887,14930352,39088169]
>>> take 20 $ fromOEIS "A001906"
[0,1,3,8,21,55,144,377,987,2584,6765,17711,46368,121393,317811,832040,2178309,5702887,14930352,39088169]

luc2n :: S IntegerSource

>>> stake 20 $ dropIp1L sLucas
[2,3,7,18,47,123,322,843,2207,5778,15127,39603,103682,271443,710647,1860498,4870847,12752043,33385282,87403803]
>>> take 20 $ fromOEIS "A005248"
[2,3,7,18,47,123,322,843,2207,5778,15127,39603,103682,271443,710647,1860498,4870847,12752043,33385282,87403803]

under (sum)

fibpfib :: S IntegerSource

>>> stake 21 $ [1] <<| plus sFib sFib
[1,0,2,2,4,6,10,16,26,42,68,110,178,288,466,754,1220,1974,3194,5168,8362]
>>> take 21 $ fromOEIS "A006355"
[1,0,2,2,4,6,10,16,26,42,68,110,178,288,466,754,1220,1974,3194,5168,8362]

under (diff)

dxFib :: S IntegerSource

>>> take 20 $ fromOEIS "A039834"
[1,1,0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597]
>>> stake 20 $ [1] <<| diff sFib
[1,1,0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597]

dxLucas :: S IntegerSource

>>> take 20 $ fromOEIS "A061084"
[1,2,1,3,4,7,11,18,29,47,76,123,199,322,521,843,1364,2207,3571,5778]
>>> stake 20 $ diff sLucas
[-1,2,1,3,4,7,11,18,29,47,76,123,199,322,521,843,1364,2207,3571,5778]

Padovans and Perrins, and Pells

Padovan

padovanPP11010 :: S IntegerSource

>>> take 30 $ fromOEIS "A000931"
[1,0,0,1,0,1,1,1,2,2,3,4,5,7,9,12,16,21,28,37,49,65,86,114,151,200,265,351,465,616]
>>> stake 30 $ padovanPP11010
[1,0,0,1,0,1,1,1,2,2,3,4,5,7,9,12,16,21,28,37,49,65,86,114,151,200,265,351,465,616]

padovan :: S IntegerSource

>>> take 30 $ fromOEIS "A134816"
[1,1,1,2,2,3,4,5,7,9,12,16,21,28,37,49,65,86,114,151,200,265,351,465,616,816,1081,1432,1897,2513]
>>> stake 30 $ padovan
[1,1,1,2,2,3,4,5,7,9,12,16,21,28,37,49,65,86,114,151,200,265,351,465,616,816,1081,1432,1897,2513]

rpadovan :: G Integer IntegerSource

>>> stake 30 $ revFix rpadovan
[1,1,1,2,2,3,4,5,7,9,12,16,21,28,37,49,65,86,114,151,200,265,351,465,616,816,1081,1432,1897,2513]

d2xpadovan :: S IntegerSource

>>> take 31 $ fromOEIS "A133034"
[1,0,1,1,1,0,0,1,0,1,1,1,2,2,3,4,5,7,9,12,16,21,28,37,49,65,86,114,151,200,265]
>>> stake 30 $ diff $ diff $ revFix rpadovan
[0,1,-1,1,0,0,1,0,1,1,1,2,2,3,4,5,7,9,12,16,21,28,37,49,65,86,114,151,200,265]

Perrin

perrin :: S IntegerSource

>>> take 30 $ fromOEIS "A001608"
[3,0,2,3,2,5,5,7,10,12,17,22,29,39,51,68,90,119,158,209,277,367,486,644,853,1130,1497,1983,2627,3480]
>>> stake 30 $ perrin
[3,0,2,3,2,5,5,7,10,12,17,22,29,39,51,68,90,119,158,209,277,367,486,644,853,1130,1497,1983,2627,3480]

rperrin :: G Integer IntegerSource

>>> stake 30 $ revFix rperrin
[3,0,2,3,2,5,5,7,10,12,17,22,29,39,51,68,90,119,158,209,277,367,486,644,853,1130,1497,1983,2627,3480]

Pell

cPell :: S IntegerSource

Generating Function:

z -------------------- z^2 + 2z - 1

>>> take 20 $ fromOEIS "A000129"
[0,1,2,5,12,29,70,169,408,985,2378,5741,13860,33461,80782,195025,470832,1136689,2744210,6625109]

cPellH :: (a, a) -> aSource

cPellT :: Num a => (a, a) -> a -> (a, a)Source

>>> stake 20 $ cPell
[0,1,2,5,12,29,70,169,408,985,2378,5741,13860,33461,80782,195025,470832,1136689,2744210,6625109]

rpell :: G Integer IntegerSource

>>> stake 20 $ revFix rpell
[0,1,2,5,12,29,70,169,408,985,2378,5741,13860,33461,80782,195025,470832,1136689,2744210,6625109]

Who invited the J's?

Jacobsthal Sequence

jacob :: S IntegerSource

>>> take 20 $ fromOEIS "A001045"
[0,1,1,3,5,11,21,43,85,171,341,683,1365,2731,5461,10923,21845,43691,87381,174763]
>>> stake 20 $ jacob
[0,1,1,3,5,11,21,43,85,171,341,683,1365,2731,5461,10923,21845,43691,87381,174763]

rjacob :: G Integer IntegerSource

>>> stake 20 $ revFix rjacob
[0,1,1,3,5,11,21,43,85,171,341,683,1365,2731,5461,10923,21845,43691,87381,174763]

Jacobsthal-Lucas Sequence

jacobl :: S IntegerSource

>>> take 20 $ fromOEIS "A014551"
[2,1,5,7,17,31,65,127,257,511,1025,2047,4097,8191,16385,32767,65537,131071,262145,524287]
>>> stake 20 $ jacobl
[2,1,5,7,17,31,65,127,257,511,1025,2047,4097,8191,16385,32767,65537,131071,262145,524287]

rjacobl :: G Integer IntegerSource

>>> stake 20 $ revFix rjacobl
[2,1,5,7,17,31,65,127,257,511,1025,2047,4097,8191,16385,32767,65537,131071,262145,524287]

Josephus Numbers

jos :: S IntegerSource

>>> take 30 $ drop 1 $ fromOEIS "A006257"
[1,1,3,1,3,5,7,1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29]
>>> stake 30 $ jos
[1,1,3,1,3,5,7,1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29]

josAlt :: S IntegerSource

>>> stake 30 $ josAlt
[1,1,3,1,3,5,7,1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29]

Basically Binary (Base 2)

Most Significant Bit

msb :: S IntegerSource

>>> take 30 $ drop 1 $ fromOEIS "A053644"
[1,2,2,4,4,4,4,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
>>> stake 30 $ msb
[1,2,2,4,4,4,4,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]

Thue-Morse Sequence

athue :: S IntegerSource

>>> take 30 $ fromOEIS "A010060"
[0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0]
>>> stake 30 $ athue
[0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0]

thue' :: S IntegerSource

>>> stake 30 $ thue
[0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0]

Something with twos!

binlike1 :: S IntegerSource

>>> stake 30 $ binlike1
[0,1,0,1,2,0,0,1,2,2,4,0,0,0,0,1,2,2,4,2,4,4,8,0,0,0,0,0,0,0]

Something with twos! (2)

binlike2 :: S IntegerSource

>>> stake 30 $ binlike2
[0,1,1,0,1,2,0,2,1,0,2,2,0,4,2,0,1,4,0,2,2,0,2,4,0,4,4,0,2,8]

Who knows what this is?

lsb :: S IntegerSource

>>> take 30 $ fromOEIS "A000035"
[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]
>>> stake 30 $ bsum 0 |~| 1
[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]

Binary Sum Carry

sumcarry :: S IntegerSource

>>> take 30 $ fromOEIS "A011371"
[0,0,1,1,3,3,4,4,7,7,8,8,10,10,11,11,15,15,16,16,18,18,19,19,22,22,23,23,25,25]
>>> stake 30 $ sumcarry
[0,0,1,1,3,3,4,4,7,7,8,8,10,10,11,11,15,15,16,16,18,18,19,19,22,22,23,23,25,25]

Fractals

Apollonian Fractal

D2: (-1,2,2,3)

apolloD2 :: Floating a => [a] -> aSource

>>> take 20 $ fromOEIS "A060790"
[1,2,2,3,15,38,110,323,927,2682,7754,22403,64751,187134,540822,1563011,4517183,13054898,37729362,109039875]
>>> stake 20 $ revFix apolloD2
[2.0,2.0,3.0,15.0,38.0,110.0,323.0,927.0,2682.0,7754.0,22403.0,64751.0,187134.0,540822.0,1563011.0,4517183.0,1.3054898e7,3.7729362e7,1.09039875e8,3.15131087e8]

apolloD2alt :: Floating a => [a] -> aSource

>>> stake 20 $ revFix apolloD2alt
[2.0,2.0,3.0,-1.0,2.0,2.0,3.0,-1.0,2.0,2.0,3.0,-1.0,2.0,2.0,3.0,-1.0,2.0,2.0,3.0,-1.0]

apd2 :: Floating a => [a] -> aSource

D3: (-0,0,1,1)

fr :: Num t => (t, t, t, t, t, t, t, t) -> (t, t, t, t, t, t, t, t)Source

proy :: (a, a, a, a, a, a, a, a) -> Integer -> aSource

streamApD3 :: S IntegerSource

>>> stake 32 $ streamApD3
[0,0,1,1,1,2,2,3,4,8,9,9,15,32,32,33,56,120,121,121,209,450,450,451,780,1680,1681,1681,2911,6272,6272,6273]

streamApD3' :: S (Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer)Source

>>> stake 4 $ streamApD3'
[(0,0,1,1,1,2,2,3),(4,8,9,9,15,32,32,33),(56,120,121,121,209,450,450,451),(780,1680,1681,1681,2911,6272,6272,6273)]

Some Fractal Numbers

frac :: S IntegerSource

>>> take 30 $ fromOEIS "A025480"
[0,0,1,0,2,1,3,0,4,2,5,1,6,3,7,0,8,4,9,2,10,5,11,1,12,6,13,3,14,7]
>>> stake 30 $ frac
[0,0,1,0,2,1,3,0,4,2,5,1,6,3,7,0,8,4,9,2,10,5,11,1,12,6,13,3,14,7]

Greatest Odd Divisor

god :: S IntegerSource

>>> take 30 $ fromOEIS "A000265"
[1,1,3,1,5,3,7,1,9,5,11,3,13,7,15,1,17,9,19,5,21,11,23,3,25,13,27,7,29,15]
>>> stake 30 $ god
[1,1,3,1,5,3,7,1,9,5,11,3,13,7,15,1,17,9,19,5,21,11,23,3,25,13,27,7,29,15]

Dunno

blah :: S IntegerSource

diverges!!

The Zoo

Moser-de-Bruijn sequence

Fermi Dirac Numbers

5-Smooth (Hamming) (Regular) Numbers

hamming :: S IntegerSource

>>> take 30 $ fromOEIS "A051037"
[1,2,3,4,5,6,8,9,10,12,15,16,18,20,24,25,27,30,32,36,40,45,48,50,54,60,64,72,75,80]
>>> stake 30 $ hamming
[1,2,3,4,5,6,8,9,10,12,15,16,18,20,24,25,27,30,32,36,40,45,48,50,54,60,64,72,75,80]

Dunno this one either?

a092323 :: S IntegerSource

>>> take 30 $ fromOEIS "A092323"
[0,1,1,3,3,3,3,7,7,7,7,7,7,7,7,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
>>> stake 30 $ (diff sNat - msb)
[0,-1,-1,-3,-3,-3,-3,-7,-7,-7,-7,-7,-7,-7,-7,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15]

Carry Bits

carry :: S IntegerSource

>>> take 30 $ fromOEIS "A007814"
[0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1]
>>> stake 30 $ carry
[0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1]

altCarry :: S IntegerSource

FIXME: Incorrect!

tree :: Integral a => a -> S aSource

>>> stake 30 $ tree 0
[0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1]

Non-Negative Integers. Repeated. Floor (n/2)

a004526 :: S IntegerSource

>>> take 30 $ fromOEIS "A004526"
[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14]
>>> stake 30 $ a004526
[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14]

Square Pyramidal Numbers

a000330 :: S IntegerSource

>>> take 16 $ 0 : fromOEIS "A000330"
[0,0,1,5,14,30,55,91,140,204,285,385,506,650,819,1015]
>>> stake 16 $ a000330
[0,0,1,5,14,30,55,91,140,204,285,385,506,650,819,1015]

The Perturbation Method

iterate k = 2^n-k

iterk2nk :: S IntegerSource

>>> take 21 $ 1 : fromOEIS "A078008"
[1,1,0,2,2,6,10,22,42,86,170,342,682,1366,2730,5462,10922,21846,43690,87382,174762]

iterk2nkH :: (a, b) -> aSource

iterk2nkT :: Num a => (a, a) -> a -> (a, a)Source

>>> stake 21 $ [1,1] <<| iterk2nk
[1,1,0,2,2,6,10,22,42,86,170,342,682,1366,2730,5462,10922,21846,43690,87382,174762]

What the heck is this?

a090017 :: G Integer IntegerSource

>>> take 15 $ fromOEIS "A090017"
[0,1,4,18,80,356,1584,7048,31360,139536,620864,2762528,12291840,54692416,243353344]
>>> stake 15 $ revFix a090017
[0,1,4,18,80,356,1584,7048,31360,139536,620864,2762528,12291840,54692416,243353344]

Horadam (0,1,4,2) Numbers

horadam0142 :: G Integer IntegerSource

>>> take 15 $ fromOEIS "A085449"
[0,1,2,8,24,80,256,832,2688,8704,28160,91136,294912,954368,3088384]
>>> stake 15 $ revFix horadam0142
[0,1,2,8,24,80,256,832,2688,8704,28160,91136,294912,954368,3088384]

Some random thing I found.

a002605 :: G Integer IntegerSource

>>> take 15 $ fromOEIS "A002605"
[0,1,2,6,16,44,120,328,896,2448,6688,18272,49920,136384,372608]
>>> stake 15 $ revFix a002605
[0,1,2,6,16,44,120,328,896,2448,6688,18272,49920,136384,372608]