This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A331835 #25 Feb 16 2025 08:33:59 %S A331835 0,1,2,3,3,4,5,6,5,6,7,8,8,9,10,11,7,8,9,10,10,11,12,13,12,13,14,15, %T A331835 15,16,17,18,11,12,13,14,14,15,16,17,16,17,18,19,19,20,21,22,18,19,20, %U A331835 21,21,22,23,24,23,24,25,26,26,27,28,29,13,14,15,16,16 %N A331835 Replace 2^k in binary expansion of n with k-th prime number for any k > 0 (and keep 2^0). %C A331835 Every nonnegative integer appears in this sequence as A008578 is a complete sequence. %C A331835 For any m >= 0, m appears A036497(m) times, the first and last occurrences being at indices A345297(m) and A200947(m), respectively. - _Rémy Sigrist_, Jun 13 2021 %H A331835 Rémy Sigrist, <a href="/A331835/b331835.txt">Table of n, a(n) for n = 0..8192</a> %H A331835 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/CompleteSequence.html">Complete Sequence</a> %H A331835 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A331835 a(2*n) = A089625(n) for any n > 0. %F A331835 a(2*n+1) = A089625(n) + 1 for any n > 0. %F A331835 G.f.: x/(1 - x^2) + (1/(1 - x)) * Sum_{k>=1} prime(k) * x^(2^k) / (1 + x^(2^k)). - _Ilya Gutkovskiy_, May 24 2024 %e A331835 For n = 43: %e A331835 - 43 = 2^0 + 2^1 + 2^3 + 2^5, %e A331835 - so a(43) = 2^0 + prime(1) + prime(3) + prime(5) = 1 + 2 + 5 + 11 = 19. %t A331835 Array[Total@ Map[If[# == 0, 1, Prime[#]] &, Position[Reverse@ IntegerDigits[#, 2], 1][[All, 1]] - 1] &, 68] (* _Michael De Vlieger_, Jan 29 2020 *) %o A331835 (PARI) a(n) = my (b=Vecrev(binary(n\2))); n%2 + sum(k=1, #b, if (b[k], prime(k), 0)) %o A331835 (Python) %o A331835 from sympy import prime %o A331835 def p(n): return prime(n) if n >= 1 else 1 %o A331835 def a(n): return sum(p(i)*int(b) for i, b in enumerate(bin(n)[:1:-1])) %o A331835 print([a(n) for n in range(69)]) # _Michael S. Branicky_, Jun 13 2021 %Y A331835 Cf. A008578, A036497, A048672, A089625, A200947, A345297. %K A331835 nonn,base %O A331835 0,3 %A A331835 _Rémy Sigrist_, Jan 28 2020