Skip to content

Instantly share code, notes, and snippets.

@khayrov
khayrov / ulam.hs
Created May 13, 2011 07:56
Ulam spiral visualization
import Data.List
import Graphics.Gloss
import Graphics.Gloss.Data.Point
infixl 6 |+|
(x, y) |+| (x', y') = (x + x', y + y')
spiral = scanl (|+|) (0, 0) steps
where
@khayrov
khayrov / Makefile
Created December 26, 2010 23:05
Micro-optimized (but algorithmically inefficient) prime numbers finder
CFLAGS=-O2 -ffast-math -march=native
CXXFLAGS=$(CFLAGS)
ifneq (, $(findstring 64, $(shell uname -m)))
asm_file=prime64.S
x86_64=1
else
asm_file=prime32.S
endif