login
Ultimate modulo 4: right-hand nonzero digit of n when written in base 4.
9

%I #55 Aug 22 2023 08:02:11

%S 1,2,3,1,1,2,3,2,1,2,3,3,1,2,3,1,1,2,3,1,1,2,3,2,1,2,3,3,1,2,3,2,1,2,

%T 3,1,1,2,3,2,1,2,3,3,1,2,3,3,1,2,3,1,1,2,3,2,1,2,3,3,1,2,3,1,1,2,3,1,

%U 1,2,3,2,1,2,3,3,1,2,3,1,1,2,3,1,1,2,3,2,1,2,3,3,1,2,3,2,1,2,3,1,1,2,3,2,1

%N Ultimate modulo 4: right-hand nonzero digit of n when written in base 4.

%C From _Bradley Klee_, Sep 12 2015: (Start)

%C In some guise, this sequence is a linear encoding of the three fixed-point half-hex tilings (cf. Baake & Grimm, Frettlöh). Applying a permutation, morphism x -> 123x becomes x -> x123, which has three fixed points. Applying a partition, morphism x -> x123 becomes x ->{{3,2},{x,1}} or

%C 3 2 3 2

%C 3 1 2 1

%C 3 2 3 2 3 2

%C x -> x 1 -> x 1 1 1 -> etc.,

%C which is the substitution rule for the half-hex tiling when the numbers 1,2,3 determine the direction of a dissecting diameter inscribed on each hexagon.

%C (End)

%D M. Baake and U. Grimm, Aperiodic Order Vol. 1, Cambridge University Press, 2013, page 205.

%H Harry J. Smith, <a href="/A065882/b065882.txt">Table of n, a(n) for n = 1..1000</a>

%H D. Frettlöh, <a href="https://www.math.uni-bielefeld.de/~frettloe/papers/diss.pdf">Nichtperiodische Pflasterungen mit ganzzahligem Inflationsfaktor</a>, Dissertation, Universität Dortmund, 2002.

%H <a href="/index/Fi#final">Index entries for sequences related to final digits of numbers</a>

%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>

%F If n mod 4 = 0 then a(n) = a(n/4), otherwise a(n) = n mod 4. a(n) = A065883(n) mod 4.

%F Fixed point of the morphism: 1 ->1231, 2 ->1232, 3 ->1233, starting from a(1) = 1. Sequence read mod 2 gives A035263. a(n) = A007913(n) mod 4. - _Philippe Deléham_, Mar 28 2004

%F G.f. g(x) satisfies g(x) = g(x^4) + (x + 2 x^2 + 3 x^3)/(1 - x^4). - _Bradley Klee_, Sep 12 2015

%e a(7)=3 and a(112)=3, since 7 is written in base 4 as 13 and 112 as 1300.

%p f:= proc(n)

%p local x:=n;

%p while x mod 4 = 0 do x:= x/4 od:

%p x mod 4;

%p end proc;

%p map(f, [$1..100]); # _Robert Israel_, Jan 05 2016

%t Nest[ Flatten[ # /. {1 -> {1, 2, 3, 1}, 2 -> {1, 2, 3, 2}, 3 -> {1, 2, 3, 3}}] &, {1}, 4] (* _Robert G. Wilson v_, May 07 2005 *)

%t b[n_] := CoefficientList[Series[

%t With[{f0 = (x + 2 x^2 + 3 x^3)/(1 - x^4)},

%t Nest[ (# /. x -> x^4) + f0 &, f0, Ceiling[Log[4, n/3]]]],

%t {x, 0, n}], x][[2 ;; -1]]; b[100](* _Bradley Klee_, Sep 12 2015 *)

%t Table[Mod[n/4^IntegerExponent[n, 4], 4], {n, 1, 120}] (* _Clark Kimberling_, Oct 19 2016 *)

%o (PARI) baseE(x, b)= { local(d, e=0, f=1); while (x>0, d=x%b; x\=b; e+=d*f; f*=10); return(e) } { for (n=1, 1000, a=baseE(n, 4); while (a%10 == 0, a\=10); write("b065882.txt", n, " ", a%10) ) } \\ _Harry J. Smith_, Nov 03 2009

%o (PARI) a(n) = (n/4^valuation(n,4))%4; \\ _Joerg Arndt_, Sep 13 2015

%o (Python)

%o def A065882(n): return (n>>((~n & n-1).bit_length()&-2))&3 # _Chai Wah Wu_, Aug 21 2023

%Y In base 2 this is A000012, base 3 A060236 and base 10 A065881.

%Y Defining relations for g.f. similar to A014577.

%Y Cf. A010873, A037898, A065883, A190593.

%K base,easy,nonn

%O 1,2

%A _Henry Bottomley_, Nov 26 2001