OFFSET
1,2
COMMENTS
If the binary expansion of n is n = bit0*2^0 + bit1*2^1 + bit2*2^2 + ... then a(n) = bit0*(n+1)^0 + bit1*(n+1)^1 + bit2*(n+1)^2 + ... . In other words: Interpret the binary expansion of n as digits in base n+1.
FORMULA
a(2^n) = (2^n + 1)^n = A136516(n).
a(2^n - 1) = (2^(n^2) - 1)/(2^n - 1) = A128889(n).
a(2^n + 1) = 1 + (2^n + 2)^n.
a(n) = A104257(n+1, n).
a(n) = (1/n)*Sum_{j>=1} floor((n + 2^(j-1))/2^j) * ((n-1)*(n+1)^(j-1) + 1).
a(n) = (1/n)*Sum_{j=1..n} ((n-1)*(n+1)^A007814(j) + 1).
a(2*n) = A104258(2*n+1) - 1.
(2*m+1)^n divides a((2*m+1)^n-1) for positive m and n > 0.
EXAMPLE
n=4 in binary is 100 and interpreting those digits as base n+1 = 5 is a(4) = 25.
MATHEMATICA
a[n_] := FromDigits[IntegerDigits[n, 2], n + 1]; Array[a, 40] (* Amiram Eldar, Aug 19 2022 *)
PROG
(PARI) a(n) = fromdigits(digits(n, 2), n+1)
(Python)
def a(n): return sum((n+1)**i*int(bi) for i, bi in enumerate(bin(n)[2:][::-1]))
print([a(n) for n in range(1, 39)]) # Michael S. Branicky, Aug 02 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Thomas Scheuerle, Aug 02 2022
STATUS
approved