|
%I
%S 0,3,2,1,12,15,14,13,8,11,10,9,4,7,6,5,48,51,50,49,60,63,62,61,56,59,
%T 58,57,52,55,54,53,32,35,34,33,44,47,46,45,40,43,42,41,36,39,38,37,16,
%U 19,18,17,28,31,30,29,24,27,26,25,20,23,22,21,192,195,194,193,204,207,206
%N Write n in base 4, then replace each digit by its base 4 negative.
%C The graph of a(n) on [ 1..4^k ] resembles a plane fractal of fractal dimension 1.
%C Self-inverse considered as a permutation of the positive integers.
%H J. W. Layman, <a href="http://www.math.vt.edu/people/layman/sequences/sequences.htm">View fractal-like graph</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%H Reinhard Zumkeller, <a href="/A048647/b048647.txt">Table of n, a(n) for n = 0..16383</a>
%F a(n) = if n = 0 then 0 else 4*a(floor(n/4)) + if m = 0 then 0 else 4 - m, where m = n mod 4. - _Reinhard Zumkeller_, Apr 08 2013
%e a(15)=5, since 15 = 33(base 4) -> 11(base 4) = 5.
%t Table[FromDigits[If[#==0,0,4-#]&/@IntegerDigits[n,4],4],{n,0,70}] (* _Harvey P. Dale_, Jul 23 2012 *)
%o (Haskell)
%o a048647 0 = 0
%o a048647 n = 4 * a048647 n' + if m == 0 then 0 else 4 - m
%o where (n', m) = divMod n 4
%o -- _Reinhard Zumkeller_, Apr 08 2013
%Y Cf. A065256.
%Y Cf. A007090.
%K nonn,easy,nice,base
%O 0,2
%A John W. Layman (layman(AT)math.vt.edu (7/5/99))
|