cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A274069 a(n) is the concatenation of a(n-1) and the Hamming distance between a(n-1) and its reverse (i.e., the minimum number of bitflips needed to make them identical). Sequence written in binary.

This page as a plain text file.
%I A274069 #25 May 08 2019 11:43:29
%S A274069 1,10,1010,1010100,101010010,101010010110,101010010110100,
%T A274069 101010010110100100,1010100101101001001000,10101001011010010010001110,
%U A274069 101010010110100100100011101100,10101001011010010010001110110010100,101010010110100100100011101100101001100,10101001011010010010001110110010100110011000,10101001011010010010001110110010100110011000100000
%N A274069 a(n) is the concatenation of a(n-1) and the Hamming distance between a(n-1) and its reverse (i.e., the minimum number of bitflips needed to make them identical). Sequence written in binary.
%e A274069 Let a'(n) be the reverse of a(n). E.g., if a(n) = 10100, then a'(n) = 00101. Let hamm(b,c) denote the Hamming distance between b and c. Let concat designate concatenation of arguments.
%e A274069 a(1):=1.
%e A274069 a(2) is the concatenation of a(1) and hamm(a(1),a'(1)). a'(1) = 1. So hamm(a(1),a'(1)) = hamm('1','1') = 0. So a(2) = concat('1','0') = 10.
%e A274069 a(3) is the concatenation of a(2) and hamm(a(2),a'(2)). hamm(a(2),a'(2)) = hamm('10','01') = 2 or 10 in base 2. So a(3) = concat('10','10') = 1010.
%e A274069 a(4) is the concatenation of a(3) and hamm(a(3),a'(3)). hamm(a(3),a'(3)) = hamm('1010','0101') = 4 or 100 in base 2. So a(3) = concat('1010','100') = 10100.
%p A274069 A274069aux := proc(n)
%p A274069     option remember;
%p A274069     if n = 1 then
%p A274069         [1];
%p A274069     else
%p A274069         d := procname(n-1) ;
%p A274069         dreve := ListTools[Reverse](d) ;
%p A274069         ham := 0 ;
%p A274069         for i from 1 to nops(d) do
%p A274069             if op(i,d) <> op(i,dreve) then
%p A274069                 ham := ham+1 ;
%p A274069             end if;
%p A274069         end do:
%p A274069         if ham = 0 then
%p A274069             [op(d),0] ;
%p A274069         else
%p A274069             ListTools[Reverse](convert(ham,base,2)) ;
%p A274069             [op(d),op(%) ] ;
%p A274069         end if ;
%p A274069     end if;
%p A274069 end proc:
%p A274069 A274069 := proc(n)
%p A274069     digcatL(A274069aux(n)) ;
%p A274069 end proc:
%p A274069 seq(A274069(n),n=1..30) ; # _R. J. Mathar_, May 08 2019
%Y A274069 Cf. A144078.
%K A274069 nonn,base,easy
%O A274069 1,2
%A A274069 _Meir-Simchah Panzer_, Jun 09 2016
%E A274069 Edited by _Meir-Simchah Panzer_, Jun 12 2018
%E A274069 More terms from _R. J. Mathar_, May 08 2019.