A048436 Take the first n numbers written in base 4, concatenate them, then convert from base 4 to base 10.
1, 6, 27, 436, 6981, 111702, 1787239, 28595832, 457533321, 7320533146, 117128530347, 1874056485564, 29984903769037, 479758460304606, 7676135364873711, 491272663351917520, 31441450454522721297, 2012252829089454163026, 128784181061725066433683
Offset: 1
Examples
a(7): (1)(2)(3)(10)(11)(12)(13) = 12310111213_4 = 1787239.
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..200
Crossrefs
Programs
-
Magma
[n eq 1 select 1 else Self(n-1) * 4^(1+Ilog(4,n)) + n: n in [1..20]]; // Jason Kimberley, Nov 27 2012
-
Mathematica
a[n_]:= FromDigits[Flatten@IntegerDigits[Range@n, 4], 4]; Array[a, 20] (* Vincenzo Librandi, Dec 30 2012 *)
-
Python
from functools import reduce def A048436(n): return reduce(lambda i,j:(i<<(bool((m:=j.bit_length())&1)<<1)+(m&-2))+j,range(n+1)) # Chai Wah Wu, Feb 26 2023
Formula
a(n) = a(n-1) * 4^(1 + floor(log4(n))) + n. [Moved from A117640 by Jason Kimberley, Nov 27 2012]
Comments