Skip to content

Instantly share code, notes, and snippets.

@blackh
Created January 24, 2012 20:45
Show Gist options
  • Save blackh/1672468 to your computer and use it in GitHub Desktop.
Save blackh/1672468 to your computer and use it in GitHub Desktop.
Silverman
let silv n =
let u = make_vect (2*n+1) 0 in
let k = ref 2 in let j = ref 3 in let p = ref 3 in
u.(1)<- 1; u.(2)<-2; u.(3)<-2;
while u.(n)==0 do
for i=1 to !k do u.(!p+i) <- !j; done;
p:=!p+(!k); j:=!j+1; k:=u.(!j);
done;
u;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment