login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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
OFFSET
0,1
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: A280937 A296236 A357659 * A181172 A075430 A095080
KEYWORD
nonn,base
AUTHOR
Simon Strandgaard, Apr 13 2020
STATUS
approved