OFFSET

1,2

LINKS

Rémy Sigrist, Table of n, a(n) for n = 1..10000

Michael De Vlieger, Thomas Scheuerle, Rémy Sigrist, N. J. A. Sloane, and Walter Trump, The Binary Two-Up Sequence, arXiv:2209.04108 [math.CO], Sep 11 2022.

Rémy Sigrist, C++ program

FORMULA

Conjecture from N. J. A. Sloane, Jun 29 2022: (Start)

The following is a conjectured recurrence for a(n). Basically a(n) = a(n/2-1) if n is even, and a(n) = (n+1)/2 if n is odd, except that there are four types of n which have a different formula, and there are 19 exceptional values for small n. Note that a(n) does not depend on earlier values when n is odd.

Here is the formula, which agrees with the first 10000 terms.

There are exceptional values as far out as n=61, so we take care of them first.

Initial conditons:

If n is on the list

[1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 21, 22, 29, 30, 45, 61]

then a(n) is given by the n-th term of the following list:

[0, 2, 0, 1, 2, 3, 8, 0, 1, 5, 12, 2, 3, 7, 16, 8, 9, 0, 10,

1, 4, 11, 24, 12, 13, 2, 14, 3, 6, 15, 32, 16, 17, 8, 18, 9,

19, 0, 20, 10, 21, 1, 22, 4, 5, 11, 48, 24, 25, 12, 26, 13,

27, 2, 28, 14, 29, 3, 30, 6, 7].

Otherwise, if n is even, a(n) = a(n/2-1).

Otherwise n is odd and is not one of the exceptions.

(I) If n = 3*2^k-3, k >= 5, then a(n) = (n-1)/4.

(II) If n = 2^k-3, k >= 4 then a(n) = (n-1)/4.

(III) If n = 3*2^k-1, k >= 2 then a(n) = n+1.

(IV) If n = 2^k-1, k >= 3 then a(n) = n+1.

(V) Otherwise a(n) = (n+1)/2.

(End)

The conjecture is now known to be true. See De Vlieger et al. (2022). - N. J. A. Sloane, Aug 29 2022

PROG

(Python)

from itertools import count, islice

from collections import deque

from functools import reduce

from operator import or_

def A354773_gen(): # generator of terms

aset, aqueue, b, f = {0, 1, 2}, deque([2]), 2, False

while True:

for k in count(1):

m, j, j2, r, s = 0, 0, 1, b, k

while r > 0:

r, q = divmod(r, 2)

if not q:

s, y = divmod(s, 2)

m += y*j2

j += 1

j2 *= 2

if s > 0:

m += s*2**b.bit_length()

if m not in aset:

if (s := bin(m)[:1:-1]).count('1') == 2:

yield s.index('1')

aset.add(m)

aqueue.append(m)

if f: aqueue.popleft()

b = reduce(or_, aqueue)

f = not f

break

(C++) See Links section.

CROSSREFS

KEYWORD

base,nonn

AUTHOR

N. J. A. Sloane, Jun 26 2022

STATUS

approved