login
A345297
a(n) is the least k >= 0 such that A331835(k) = n.
4
0, 1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 22, 23, 26, 27, 29, 30, 31, 43, 45, 46, 47, 54, 55, 58, 59, 61, 62, 63, 94, 95, 107, 109, 110, 111, 118, 119, 122, 123, 125, 126, 127, 187, 189, 190, 191, 222, 223, 235, 237, 238, 239, 246, 247, 250, 251, 253, 254, 255
OFFSET
0,3
COMMENTS
Sequence A200947 gives the position of the last occurrence of a number in A331835.
LINKS
FORMULA
a(A014284(n)) = 2^n - 1.
a(n) <= A200947(n).
EXAMPLE
We have:
n| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
----------+------------------------------------------------------------------
A331835(n)| 0 1 2 3 3 4 5 6 5 6 7 8 8 9 10 11 7 8 9
So a(0) = 0,
a(1) = 1,
a(2) = 2,
a(3) = 3,
a(4) = 5,
a(5) = 6,
a(6) = 7,
a(7) = 10,
a(8) = 11,
a(9) = 13,
a(10) = 14,
a(11) = 15.
PROG
(C) See Links section.
(Python)
from sympy import prime
def p(n): return prime(n) if n >= 1 else 1
def A331835(n): return sum(p(i)*int(b) for i, b in enumerate(bin(n)[:1:-1]))
def adict(klimit):
adict = dict()
for k in range(klimit+1):
fk = A331835(k)
if fk not in adict: adict[fk] = k
n, alst = 0, []
while n in adict: alst.append(adict[n]); n += 1
return alst
print(adict(255)) # Michael S. Branicky, Jun 13 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jun 13 2021
STATUS
approved