OFFSET
1,16
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
From Robert Israel, Oct 16 2015: (Start)
G.f.: (1-x)^(-1) * Sum_{j>=0} x^(4^(j+1)*(1-x^(4^j))*(1+x^(4^j)+x^(4*4^j)+x^(5*4^j)+x^(6*4^j)+x^(8*4^j)+x^(9*4^j)+x^(10*4^j)+x^(11*4^j)+x^(12*4^j))/(1-x^(4^(j+2))).
For n >= 4, a(n) - a(floor(n/4)) = 0 if n == 1, 2, 3, 6, 7, or 11 (mod 16), 1 otherwise. (End)
MAPLE
A037827 := proc(n)
a := 0 ;
dgs := convert(n, base, 4);
for i from 2 to nops(dgs) do
if op(i, dgs)>=op(i-1, dgs) then
a := a+1 ;
end if;
end do:
a ;
end proc: # R. J. Mathar, Oct 16 2015
S:= [1, 2, 3, 6, 7, 11]:
f:= proc(n) option remember;
procname(floor(n/4)) + `if`(has(S, n mod 16), 0, 1)
end proc:
f(0):= 0:
seq(f(n), n=1..100); # Robert Israel, Oct 16 2015
PROG
(PARI) a(n) = {my(d = Vecrev(digits(n, 4))); my(dd = vector(#d-1, k, d[k+1] - d[k])); #select(x->(x>=0), dd); } \\ Michel Marcus, Oct 16 2015
(Python)
def A037827(n):
s = '0'*(n.bit_length()&1)+bin(n)[2:]
return sum(1 for i in range(0, len(s)-2, 2) if s[i:i+2]>=s[i+2:i+4]) # Chai Wah Wu, Feb 02 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Sign in name corrected by R. J. Mathar, Oct 16 2015
STATUS
approved