login
Triangle read by rows: T(n,k) is the frequency of occurrence of binary words, under iterations of making the n-bit binary representation of k palindromic, by binary-subtracting its bit reversal, 0 <= k < 2^n.
1

%I #34 May 08 2021 08:33:50

%S 0,0,0,1,0,2,0,0,0,2,0,4,0,0,0,0,2,0,0,1,0,9,0,12,0,2,0,0,6,0,0,0,0,0,

%T 0,0,4,0,0,2,0,2,0,0,0,16,0,22,0,0,0,2,0,4,0,0,12,0,0,0,0,0,0,0

%N Triangle read by rows: T(n,k) is the frequency of occurrence of binary words, under iterations of making the n-bit binary representation of k palindromic, by binary-subtracting its bit reversal, 0 <= k < 2^n.

%C This sequence is a side result of the same process used for generating A338203.

%C All operations are performed with n bits. In particular, the bit-reversal of k considers k to be an n-bit binary word and k is a palindrome if it is equal to its bit reversal in this sense. The subtraction is performed modulo 2^n.

%C The sequence is divided into blocks of length 2^n, n = 1, 2, 3, ... .

%C Sequence looks random if only a small amount of data is seen, but shows self-similarity and scale invariance if seen from a broader perspective.

%C An example is provided in "links" section.

%C T(n,0) is set to zero by definition.

%C If for any number the operation of subtracting its binary reversed bitsequence is carried out, the result is either 0 or one of the numbers k in the set T(n,k) > 0. Numbers k with bigger values T(n,k) are more likely the result of such operation.

%H Thomas Scheuerle, <a href="/A338264/b338264.txt">Table of n, a(n) for n = 1..16382. Max: T(13,2^13-1)</a>

%H Thomas Scheuerle, <a href="/A338264/a338264.png">See here selfsimilarity in graph of first 131070 elements</a>

%H Thomas Scheuerle, <a href="/A338264/a338264_1.png">Fast Walsh-Hadamard transform (MATLAB)plot(fwht(a(1:2^16),2^16,'hadamard'))</a>

%e Triangle begins:

%e 0, 0; Data starts with n=1

%e 0, 1, 0, 2;

%e 0, 0, 0, 2, 0, 4, 0, 0;

%e 0, 0, 2, 0, 0, 1, 0, 9, 0, 12, 0, 2, 0, 0, 6, 0;

%e ...

%e n=4 Four bit wordlength.

%e For each row of n we let m iterate from 0 to 2^n-1.

%e For this example let's take a snapshot at m=5 in binary : 0101

%e 0101 - 1010 = 1011 (2^4 + 5 - 10)=11 -> T((2^n-1)+11):=T((2^n-1)+11)+1

%e (we increment counts for frequency)

%e 1011 - 1101 = 1110 (2^4 + 11 - 13)=14 -> T((2^n-1)+14):=T((2^n-1)+14)+1

%e 1110 - 0111 = 0111 (14 - 7)=7 -> T((2^n-1)+7):=T((2^n-1)+7)+1

%e 0111 - 1110 = 1001 (2^4 + 7 -14)=9 -> T((2^n-1)+9):=T((2^n-1)+9)+1

%e Now 1001 is palindromic, we stop m=5 and proceed with m=6.

%e If we did not stop we would reach zero. T(n,0) is zero by definition.

%o (MATLAB)

%o sequence = [];

%o for numberofBits = 1:maxNumberofBits

%o numbersPerWordlength = 2^numberofBits;

%o frequency_list = zeros(1,numbersPerWordlength);

%o for n = 1:numbersPerWordlength

%o word = n-1;

%o while word > 0

%o word_reversed = 0;

%o % reverse bit order

%o for i = 1:numberofBits

%o word_reversed = bitset(word_reversed,numberofBits-i+1,bitget(word,i));

%o end

%o % binary subtraction with worlength of numbersPerWordlength

%o if word >= word_reversed

%o word = word-word_reversed;

%o else

%o word = numbersPerWordlength + word - word_reversed;

%o end

%o if word > 0 % if == 0 it was already a palindrome

%o frequency_list(word+1) = frequency_list(word+1)+1;

%o end

%o end

%o end

%o sequence = [sequence frequency_list];

%o end

%Y Cf. A338203.

%K nonn,base,tabf

%O 1,6

%A _Thomas Scheuerle_, Oct 19 2020