|
|
A258059
|
|
Let n = Sum_{i=0..k} d_i*4^i be the base-4 expansion of n, with 0 <= d_i < 4. Then a(n) = minimal i such that d_i is not 1, or k+1 if there is no such i.
|
|
2
|
|
|
1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,5
|
|
COMMENTS
|
This is the "General Ruler Sequence Base 4 Focused at 1" of Webster (2015).
|
|
LINKS
|
|
|
FORMULA
|
Recurrence: a(1)=1; thereafter a(4*n+1) = a(n)+1, a(4*n+j) = 0 for j = 0,2,3. G.f. g(x) = Sum_{k>=0} k * x^((4^k-1)/3) * (1 + x^(2*4^k) + x^(3*4^k))/(1 - x^(4*4^k)) satisfies g(x) = x*g(x^4) + x/(1-x^4). - Robert Israel, Jun 08 2015
|
|
EXAMPLE
|
1 = 0*4+1, so a(1)=1.
7 = 1*4+3, so a(7)=0.
21 = 0*4^3+1*4^2+1*4+1, so a(21)=3.
523 base 10 is 20023 in base 4, so a(523)=0.
1365 base 10 is 111111 in base 4, so a(1365)=6.
|
|
MAPLE
|
f:= proc(n)
if n mod 4 = 1 then procname((n-1)/4) + 1 else 0 fi
end proc:
|
|
PROG
|
(PARI) a(n) = {v = Vecrev(digits(n, 4)); for (i=1, #v, if (v[i] != 1, return (i-1)); ); return(#v); }
(Haskell)
a258059 = f 0 . a030386_row where
f i [] = i
f i (t:ts) = if t == 1 then f (i + 1) ts else i
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|