login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A037827 Number of i such that d(i) >= d(i-1), where Sum_{i=0..m} d(i)*4^i is the base-4 representation of n. 2
0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,16
LINKS
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
Cf. A037811.
Sequence in context: A175940 A299236 A353970 * A086074 A180601 A331048
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Sign in name corrected by R. J. Mathar, Oct 16 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 08:27 EDT 2024. Contains 371964 sequences. (Running on oeis4.)