More Geometric Integer Sequences
The nature of the code given in the following examples is explained in the index document.

Geometric integer sequences beyond those outlined in the main file can easily be generated.  The calculations given below explore such extensions - More Basic Geometrics, and Selected by Property.

Triangular and Square Integer Sequences

The following definitions are those given in the main file.

   sq =: *:           NB. squares
   tr =: -:@* >:      NB. n(n+1)/2
   ts =: -:@* 3&+     NB. n(n+3)/2
   tt =: <:@-:@* 3&+  NB. n(n+3)/2 - 1


More Basic Geometric Sequences

Numbers which count a regular geometric arrangement of points are called figurate numbers, and these are described by Eric Weisstein.

The pentagonal integers are the next in geometric order.

   pt =: -:@* <:@*&3     NB. defines pt
   pt 1+i.15             NB. applies pt to 1 .. 15
0 1 5 12 22 35 51 70 92 117 145 176 210 247 287

This sequence, n(3n-1)/2, is A000326.  Note the following interesting correspondences:

   (pt-sq) 1+i.15
0 0 1 3 6 10 15 21 28 36 45 55 66 78 91
   (sq-tr) 1+i.15
0 0 1 3 6 10 15 21 28 36 45 55 66 78 91
   tr 1+i.13
1 3 6 10 15 21 28 36 45 55 66 78 91

The next sequence, the hexagonal integers n(2n-1), is A000384

   hx =: * <:@@+:        NB. defines hx
   hx 1+i.15             NB. applies hx to 1 .. 15
1 6 15 28 45 66 91 120 153 190 231 276 325 378 435

The next sequence, the heptagonal integers n(5n-3)/2, is A000566

   hp =: -:@* -&3@*&5     NB. defines hp
   hp 1+i.15              NB. applies hp to 1 .. 15
1 7 18 34 55 81 112 148 189 235 286 342 403 469 540

The next sequence, the octagonal integers n(3n-2), is A000567

   oc =: * -&2@*&3       NB. defines oc
   oc 1+i.15             NB. applies oc to 1 .. 15
1 8 21 40 65 96 133 176 225 280 341 408 481 560 645


Selection by Property

Subsequences may be selected from geometric sequences by copying only those integers with a particular property.

Odd and Even Terms

Let's start by selecting odd or even terms of a sequence, triangular numbers first.

   odd =: #~ 2&|        NB. select odd
   odd tr i.30          NB. odd triangular
1 3 15 21 45 55 91 105 153 171 231 253 325 351 438
   even =: #~ -.@|~&2   NB. select even
   even tr i.30         NB. even triangular
0 6 10 28 36 66 78 120 136 190 210 276 300 378 406

These two sequences are in the Encyclopedia as, respectively, A014493 and A014494

These selected terms are rather monotonous, however.  They can be made more interesting by a form of halving:  even terms simply halved, odd terms decremented before halving so that they will be integral.

   hlv =: -:@(- 2&|)        NB. integral halving
   hlv odd tr i.30          NB. halve odd triangular
0 1 7 10 22 27 45 52 76 85 115 126 162 175 217
   hlv even tr i.30         NB. halve even triangular
0 3 5 14 18 33 39 60 68 95 105 138 150 189 203

These two sequences are now in the Encyclopedia as, respectively, A074377 and A074378.  Curiously, the combination of these two sequences, as given by hlv tr i.30 to yield 0 0 1 3 5 7 10 14 18 22 27 33 39 45 52 is in the Encyclopedia as A011848 where it is described as [C(n,2)/2].