login
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.
8

%I #9 Sep 16 2019 06:38:57

%S 1,4,8,6,12,14,16,9,18,20,24,26,28,22,39,15,36,35,40,38,57,34,48,49,

%T 51,44,46,33,60,77,64,32,75,56,81,68,76,58,100,55,84,111,88,62,125,70,

%U 96,91,98,95,134,72,108,82,141,80,140,92,120,156,124,94,121,52,152,145

%N 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.

%C Sequence is prime-free.

%H K. Strassburger, <a href="/A064494/a064494.jpg">Plot of shotgun numbers</a>

%e B(1) = 1,2,3,4,5,6,7,8, 9,10,11,12,13,14,...

%e B(2) = 1,4,3,2,5,8,7,6, 9,12,11,10,13,16,...

%e B(3) = 1,4,8,2,5,3,7,6,10,12,11, 9,13,16,...

%e B(4) = 1,4,8,6,5,3,7,2,10,12,11,14,13,16,...

%t 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 *)

%o (SageMath)

%o def divsign(s, k):

%o if not k.divides(s): return 0

%o return (-1)^(s//k)*k

%o def A064494(n):

%o s = n

%o for k in srange(n, 1, -1):

%o s -= divsign(s, k)

%o return s

%o print([A064494(n) for n in (1..66)]) # _Peter Luschny_, Sep 16 2019

%Y Cf. A064728, A064590, A064627.

%K nice,nonn

%O 1,2

%A Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Oct 16 2001