OFFSET
0,3
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..2000
Rémy Sigrist, C program for A345297
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