OFFSET
1,3
COMMENTS
For n >= 2 sequence {a(n+2)} is the minimal recursive such that A007814(a(n+2))=A007814(n). - Vladimir Shevelev, Apr 27 2009
A053645(a(n)) = n-1 for n > 0. - Reinhard Zumkeller, May 20 2009
a(n+1) is also the number of nodes in a complete binary tree with n nodes in the bottommost level. - Jacob Jona Fahlenkamp, Feb 01 2023
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Vladimir Shevelev, Several results on sequences which are similar to the positive integers, arXiv:0904.2101 [math.NT], 2009. [Vladimir Shevelev, Apr 15 2009]
FORMULA
For n > 0, a(n) = 3n - 2 - A006257(n-1). - Ralf Stephan, Sep 16 2003
a(0) = 0, a(1) = 1, for n > 0: a(2n) = 2*a(n) + 1, a(2n+1) = 2*a(n+1). - Philippe Deléham, Feb 29 2004
a(n+2) = min{m>a(n+1): A007814(m)=A007814(n)}; A010060(a(n+2)) = 1-A010060(n). - Vladimir Shevelev, Apr 27 2009
a(1)=0, a(2)=1, a(2^m+k+2) = 2^(m+1) + 2^m+k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Jul 30 2016
G.f.: x/(1-x)^2 + (x/(1-x))*Sum_{k>=0} 2^k*x^(2^k). - Robert Israel, Aug 03 2016
a(2^m+k) = A004761(2^m+k) + 2^m, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 08 2016
For n > 0, a(n+1) = n + 2^ceiling(log_2(n)) - 1. - Jacob Jona Fahlenkamp, Feb 01 2023
MAPLE
0, 1, seq(seq(3*2^d+x, x=0..2^d-1), d=0..6); # Robert Israel, Aug 03 2016
MATHEMATICA
Select[Range@ 125, If[Length@ # < 2, #, Take[#, 2]] &@ IntegerDigits[#, 2] != {1, 0} &] (* Michael De Vlieger, Aug 02 2016 *)
PROG
(PARI) is(n)=n<2 || binary(n)[2] \\ Charles R Greathouse IV, Sep 23 2012
(PARI) print1("0, 1"); for(i=0, 5, for(n=3<<i, (4<<i)-1, print1(", "n))) \\ Charles R Greathouse IV, Sep 23 2012
(PARI) a(n) = if(n<=2, n-1, (n-=2) + 2<<logint(n, 2)); \\ Kevin Ryde, Jul 22 2022
(R)
maxrow <- 8 # by choice
b01 <- 1
for(m in 0:maxrow){
b01 <- c(b01, rep(1, 2^(m+1))); b01[2^(m+1):(2^(m+1)+2^m-1)] <- 0
}
a <- which(b01 == 1)
# Yosu Yurramendi, Mar 30 2017
(Python)
def A004760(n): return m+(1<<m.bit_length()) if (m:=n-2)>0 else n-1 # Chai Wah Wu, Jul 26 2023
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
EXTENSIONS
Offset changed to 1, b-file corrected. - N. J. A. Sloane, Aug 07 2016
STATUS
approved