HP Forums
(30b) Ulam Spiral - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (30b) Ulam Spiral (/thread-2426.html)



(30b) Ulam Spiral - Gerald H - 11-14-2014 10:24 AM

Finds the two difficult non-diagonal neighbours of the given natural number > 1
0 P0
1 STO 1
2 4
3 *
4 2
5 -
6 Input
7 √
8 Math
9 Up
10 Up
11 Input
12 Input
13 Input
14 +
15 STO 2
16 R↓
17 Swap
18 4
19 -
20 √
21 Math
22 Up
23 Up
24 Input
25 ?≤
26 GT 00
27 1
28 +/-
29 STO* 2
30 Lbl 00
31 RCL 1
32 RCL- 2
33 3
34 +
35 RCL 2
36 X^2
37 √
38 RCL+ 1
39 5
40 +
41 RTN

Ulam spiral begins:

... 10 11 12 13
24 9 2 3 14
23 8 1 4 15
22 7 6 5 16
21 20 19 18 17