A064494 Shotgun (or Schrotschuss) numbers: limit of the recursion B(k) =T[k](B(k-1)), where B(1) = (1,2,3,4,5,...) and T[k] is the Transformation that permutes the entries k(2i-1) and k(2i) for all positive integers i.
1, 4, 8, 6, 12, 14, 16, 9, 18, 20, 24, 26, 28, 22, 39, 15, 36, 35, 40, 38, 57, 34, 48, 49, 51, 44, 46, 33, 60, 77, 64, 32, 75, 56, 81, 68, 76, 58, 100, 55, 84, 111, 88, 62, 125, 70, 96, 91, 98, 95, 134, 72, 108, 82, 141, 80, 140, 92, 120, 156, 124, 94, 121, 52, 152, 145
Offset: 1
Examples
B(1) = 1,2,3,4,5,6,7,8, 9,10,11,12,13,14,... B(2) = 1,4,3,2,5,8,7,6, 9,12,11,10,13,16,... B(3) = 1,4,8,2,5,3,7,6,10,12,11, 9,13,16,... B(4) = 1,4,8,6,5,3,7,2,10,12,11,14,13,16,...
Links
- K. Strassburger, Plot of shotgun numbers
Programs
-
Mathematica
max = 66; b[1, j_] := j; b[k_, j_] := b[k, j] = b[k-1, j]; Do[b[k, 2j*k-k] = b[k-1, 2j*k]; b[k, 2j*k] = b[k-1, 2j*k-k], {k, 2, max}, {j, 1, max}]; a[n_] := b[max, n]; Table[a[n], {n, 1, max}] (* Jean-François Alcover, Oct 11 2012 *)
-
SageMath
def divsign(s, k): if not k.divides(s): return 0 return (-1)^(s//k)*k def A064494(n): s = n for k in srange(n, 1, -1): s -= divsign(s, k) return s print([A064494(n) for n in (1..66)]) # Peter Luschny, Sep 16 2019
Comments