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!)
A338888 a(n) = (a(n-2) bitwise-OR a(n-1)) + 1; a(1)=0, a(2)=0. 1
0, 0, 1, 2, 4, 7, 8, 16, 25, 26, 28, 31, 32, 64, 97, 98, 100, 103, 104, 112, 121, 122, 124, 127, 128, 256, 385, 386, 388, 391, 392, 400, 409, 410, 412, 415, 416, 448, 481, 482, 484, 487, 488, 496, 505, 506, 508, 511, 512, 1024, 1537, 1538, 1540, 1543, 1544 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
LINKS
FORMULA
a(6*2^n+k) = 8 * min(3,k) * 4^n + a(k), where k is positive and as small as possible. - Charlie Neder, Jul 31 2023
EXAMPLE
a(3) = (0 | 0) + 1 = 0 + 1 = 1,
a(4) = (0 | 1) + 1 = 1 + 1 = 2,
a(5) = (1 | 2) + 1 = 3 + 1 = 4,
a(6) = (2 | 4) + 1 = 6 + 1 = 7,
a(7) = (4 | 7) + 1 = 7 + 1 = 8,
a(8) = (7 | 8) + 1 = 15 + 1 = 16.
MATHEMATICA
a[1] = a[2] = 0; a[n_] := a[n] = BitOr[a[n - 1], a[n - 2]] + 1; Array[a, 55] (* Amiram Eldar, Nov 14 2020 *)
nxt[{a_, b_}]:={b, BitOr[a, b]+1}; NestList[nxt, {0, 0}, 60][[All, 1]] (* Harvey P. Dale, May 08 2021 *)
PROG
(Ruby) values = [0, 0]
30.times { values << (values[-2] | values[-1]) + 1 }
p values
(PARI) lista(nn) = {my(va = vector(nn)); for (n=3, nn, va[n] = bitor(va[n-2], va[n-1]) + 1; ); va; } \\ Michel Marcus, Nov 14 2020
(Python 3.8+) a338888 = lambda n: (0, 0, 1, 2, 4, 7)[n-1] if n<7 else (8*4**(k:=((n-1)//6).bit_length()-1)*min(3, d:=n-6*2**k)+a338888(d)) # Charlie Neder, Jul 31 2023
CROSSREFS
Sequence in context: A241548 A019539 A327099 * A369703 A337744 A045594
KEYWORD
nonn
AUTHOR
Simon Strandgaard, Nov 14 2020
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 March 29 08:45 EDT 2024. Contains 371267 sequences. (Running on oeis4.)