Mathematical Pattern Generator