Forth

I'm not too familiar with the Forth language. It's definitely an oddity. A number of people have told me that Forth is their language of choice, but I don't have daily interaction with these people.

This program compiles and runs correctly under the Win32Forth interpreter. To run the program, download the file below, copy the contents to the clipboard and paste it into the Win32Forth interpreter window. (The interpreter is named Win32Forth or Win32for.EXE.)

create candidates 1000 cells allot create temp 1 cells allot : setones 0 begin dup 1 swap cells candidates + ! 1 + dup 999 > until drop ; setones 0 candidates ! 0 1 cells candidates + ! : findone begin 1 + dup cells candidates + @ 1 = until ; : markmult temp ! 2 begin dup temp @ * cells candidates + 0 swap ! 1 + dup temp @ * 999 > until drop temp @ ; : mainloop 0 begin findone markmult dup 499 > until drop ; mainloop : printloop cr 0 begin dup cells candidates + @ 1 = if dup . S" is prime" type cr then 1 + dup 999 > until drop ; printloop

Click Here for the actual code.