number-wall-0.1.0.0: Create number walls and save them as images
Copyright(c) Owen Bechtel 2022
LicenseMIT
Safe HaskellSafe-Inferred
LanguageHaskell2010

NumberWall

Description

 
Synopsis

Documentation

type NumberWall a = (Eq a, Ring a, Euclidean a) Source #

The numberWall function works for any Euclidean domain. (In other words, there must be some sort of div function, along with addition and multiplication). Usually, this domain is either Integer or Mod p for some prime number p. Although Int and Mod n for non-prime n also have Euclidean instances, they are not actually Euclidean domains, and using numberWall with them often causes divide-by-zero errors.

type Col = Int Source #

type Row = Int Source #

numberWall :: (NumberWall a, Show a) => (Int -> a) -> Col -> Row -> a Source #

Generate the number wall for a sequence.

pagoda :: Ring a => Int -> a Source #

The pagoda sequence ([A301849](https:/oeis.orgA301849)). In mod 2, its number wall is a self-similar fractal. In mod 3 and mod 7, all zeros in its number wall are isolated.

rueppel :: Semiring a => Int -> a Source #

The Fredholm-Rueppel sequence ([A036987](https:/oeis.orgA036987)). rueppel n evaluates to 1 if n + 1 is a power of 2, and 0 otherwise. Its number wall contains zero-windows of exponentially increasing size, and an infinite diagonal line of ones.

ternary :: Ring a => Int -> a Source #

([A039974](https:/oeis.orgA039974)). The mod-3 number wall of this sequence has an infinite central region with no zeros.

saveImage Source #

Arguments

:: FilePath

File name

-> (a -> Color)

Function assigning each number a color

-> (Col, Col)

Column range

-> (Row, Row)

Row range

-> (Col -> Row -> a)

Number wall

-> IO () 

Save a number wall as a PNG file.

showSection :: (a -> String) -> (Col, Col) -> (Row, Row) -> (Col -> Row -> a) -> String Source #

Convert a section of a number wall into a string.

printSection :: (a -> String) -> (Col, Col) -> (Row, Row) -> (Col -> Row -> a) -> IO () Source #

Print a section of a number wall.