OFFSET
1,1
LINKS
Paolo P. Lava, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = (n+1) * 2^A070939(n) + n.
G.f.: (1-x)^(-2)*(5*x - 2*x^2 + Sum_{m>=1} ((2^(2*m)+2^m)*x^(2^m) - 2^(2*m)*x^(2^m+1))). - Robert Israel, Oct 14 2016
EXAMPLE
Binary representation of 12 and 13 are 1100 and 1101. Then, concat(1101,1100) = 11011100 converted in decimal representation is 220.
MAPLE
P:= proc(q) local a, b, n;
for n from 1 to q do a:=convert(n, binary); b:=convert((n+1), binary);
print(convert(a+b*10^(ilog10(a)+1), decimal, binary)); od; end: P(100);
# alternative:
f:= n -> (n+1)*2^(1+ilog2(n))+n:
map(f, [$1..100]); # Robert Israel, Oct 14 2016
MATHEMATICA
Table[FromDigits[Join @@ Map[IntegerDigits[#, 2] &, {n + 1, n}], 2], {n, 50}] (* Michael De Vlieger, Oct 14 2016 *)
PROG
(PARI) a(n) = subst(Pol(concat(binary(n+1), binary(n))), x, 2); \\ Michel Marcus, Oct 10 2016
(PARI) a(n) = (n+1)*2^(1+logint(n, 2)) + n; \\ after 2nd Maple; Michel Marcus, Oct 15 2016
(Python)
def a(n): return int(bin(n+1)[2:] + bin(n)[2:], 2)
print([a(n) for n in range(1, 51)]) # Michael S. Branicky, May 14 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Paolo P. Lava, Oct 10 2016
STATUS
approved