Skip to content

An algorithm implemented in Javascript that prints spiral pattern like that of one snail.

Notifications You must be signed in to change notification settings

chaobin/ulamespiral

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ulame Spiral

An algorithm implemented in Javascript that prints an "Ulame Spiral".

I didn't know until someone at work handed me a math magazine where Prime Number is discussed, and this very pattern is called an "Ulame Spiral".

Usage

var spiral = new ulamespiral.UlameSpiral(1); // size = 1
spiral.draw();

And you get:

1
var spiral = new ulamespiral.UlameSpiral(4); // size = 4

And you see:


07 08 09 10
06 01 02 11
05 04 03 12
16 15 14 13
var spiral = new ulamespiral.UlameSpiral(7); // size = 7

And you see:


43 44 45 46 47 48 49 
42 21 22 23 24 25 26 
41 20 07 08 09 10 27 
40 19 06 01 02 11 28 
39 18 05 04 03 12 29 
38 17 16 15 14 13 30 
37 36 35 34 33 32 31

About

An algorithm implemented in Javascript that prints spiral pattern like that of one snail.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published