%I #19 Jul 30 2023 08:47:59
%S 1,3,1,4,1,3,2,4,1,3,1,4,2,3,2,4,1,3,1,4,1,3,2,4,2,3,1,4,2,3,2,4,1,3,
%T 1,4,1,3,2,4,1,3,1,4,2,3,2,4,2,3,1,4,1,3,2,4,2,3,1,4,2,3,2,4,1,3,1,4,
%U 1,3,2,4,1,3,1,4,2,3,2,4,1,3,1,4,1,3,2,4,2,3,1,4,2,3,2,4,2,3,1,4,1
%N Number of states generated by morphism during inflation stage of paper-folding sequence.
%C a(0), a(1), ... is the fixed point of inflation morphism 1 -> 1 3, 2 -> 2 3, 3 -> 1 4, 4 -> 2 4, starting from state 1;
%C b(0), b(1), ... is the image of a(n) under encoding morphism 1 -> 0, 2 -> 1, 3 -> 0, 4 -> 1.
%C The number-wall over the rationals (signed Hankel determinants) is apparently free from zeros.
%D Jean-Paul Allouche and Jeffrey O. Shallit, Automatic sequences, Cambridge, 2003, sect. 5.1.6.
%H W. F. Lunnon, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL4/LUNNON/numbwall10.html">The number-wall algorithm: an LFSR cookbook</a>, Journal of Integer Sequences 4 (2001), no. 1, 01.1.1.
%F a(n) = b(2n) - 2 b(2n-1) + 3, where b(n) denotes A038189(n).
%p A301848 := proc(n)
%p A038189(2*n)-2*A038189(2*n-1)+3 ;
%p end proc:
%p seq(A301848(n),n=0..100) ; # _R. J. Mathar_, Mar 30 2018
%t b[n_] := If[n == 0, 0, BitGet[n, IntegerExponent[n, 2] + 1]];
%t a[n_] := b[2n] - 2 b[2n-1] + 3;
%t Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Jul 30 2023 *)
%o (Magma)
%o function b (n)
%o if n eq 0 then return 0; // alternatively, return 1;
%o else while IsEven(n) do n := n div 2; end while; end if;
%o return n div 2 mod 2; end function;
%o function a (n)
%o return b(n+n) - 2*b(n+n-1) + 3; end function;
%o nlo := 0; nhi := 32;
%o [a(n) : n in [nlo..nhi] ];
%Y Cf. A038189, A301849, A301850.
%K nonn
%O 0,2
%A _Fred Lunnon_, Mar 27 2018
|