Add generalized sirpinsky code