login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A334041 (a(n-2) XOR a(n-1)) OR (highest bit of a(n-2))*2 OR 1; a(0)=2, a(1)=3. 0
2, 3, 5, 7, 11, 13, 23, 27, 45, 55, 91, 109, 183, 219, 365, 439, 731, 877, 1463, 1755, 2925, 3511, 5851, 7021, 11703, 14043, 23405, 28087, 46811, 56173, 93623, 112347, 187245, 224695, 374491, 449389, 748983, 898779, 1497965, 1797559, 2995931, 3595117, 5991863 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

LINKS

Table of n, a(n) for n=0..42.

Wikipedia, Bitwise operation

Index entries for sequences related to binary expansion of n

EXAMPLE

5  =    101 = (1<<len(   10)) or (   10 xor    11) or 1 =    100 |     1 | 1

7  =    111 = (1<<len(   11)) or (   11 xor   101) or 1 =    100 |   110 | 1

11 =   1011 = (1<<len(  101)) or (  101 xor   111) or 1 =   1000 |    10 | 1

13 =   1101 = (1<<len(  111)) or (  111 xor  1011) or 1 =   1000 |  1100 | 1

23 =  10111 = (1<<len( 1011)) or ( 1011 xor  1101) or 1 =  10000 |   110 | 1

27 =  11011 = (1<<len( 1101)) or ( 1101 xor 10111) or 1 =  10000 | 11010 | 1

45 = 101101 = (1<<len(10111)) or (10111 xor 11011) or 1 = 100000 |  1100 | 1

MAPLE

a:= proc(n) option remember; uses Bits; `if`(n<2, n+2,

      Or(1, Or(2^ilog2(2*a(n-2)), Xor(a(n-2), a(n-1)))))

    end:

seq(a(n), n=0..50);  # Alois P. Heinz, Apr 13 2020

PROG

(Ruby) v=[2, 3]; 100.times{a=v[-2]; b=v[-1]; v<<((1<<a.bit_length)|(a^b)|1)}; p v

(PARI) f(x, y)=bitor(1<<(exponent(x)+1)+1, bitxor(x, y))

first(n)=if(n<1, return([2])); my(v=vector(n+1)); v[1]=2; v[2]=3; for(i=3, n+1, v[i]=f(v[i-2], v[i-1])); v \\ Charles R Greathouse IV, Apr 19 2020

CROSSREFS

Sequence in context: A171574 A280937 A296236 * A181172 A075430 A095080

Adjacent sequences:  A334038 A334039 A334040 * A334042 A334043 A334044

KEYWORD

nonn,base

AUTHOR

Simon Strandgaard, Apr 13 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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 20 13:10 EDT 2021. Contains 345164 sequences. (Running on oeis4.)