cp's OEIS Frontend

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.

Showing 1-3 of 3 results.

A200947 Sequence A007924 expressed in decimal.

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 9, 16, 17, 18, 20, 32, 33, 64, 65, 66, 68, 128, 129, 256, 257, 258, 260, 512, 513, 514, 516, 517, 520, 1024, 1025, 2048, 2049, 2050, 2052, 2053, 2056, 4096, 4097, 4098, 4100, 8192, 8193, 16384, 16385, 16386, 16388, 32768, 32769, 32770
Offset: 0

Views

Author

Frank M Jackson, Nov 24 2011

Keywords

Examples

			8=7+1, hence A007924(8)=10001, so a(8)=17.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local m, p, r; m:=n; r:=0;
          while m>0 do
            if m=1 then r:=r+1; break fi;
            p:= prevprime(m+1); m:= m-p;
            r:= r+2^numtheory[pi](p)
          od; r
        end:
    seq(a(n), n=0..52);  # Alois P. Heinz, Jun 12 2023
  • Mathematica
    cprime[n_Integer] := If[n==0, 1, Prime[n]]; gentable[n_Integer] := (m=n; ptable={}; While[m != 0, (i = 0; While[cprime[i] <= m, i++]; j=0; While[j
    				

Formula

a(n) = decimal(A007924(n)).
a(n) mod 2 = A121559(n) for n>=1. - Alois P. Heinz, Jun 12 2023

Extensions

Edited by N. J. A. Sloane, May 20 2023

A331835 Replace 2^k in binary expansion of n with k-th prime number for any k > 0 (and keep 2^0).

Original entry on oeis.org

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, 15, 16, 17, 18, 11, 12, 13, 14, 14, 15, 16, 17, 16, 17, 18, 19, 19, 20, 21, 22, 18, 19, 20, 21, 21, 22, 23, 24, 23, 24, 25, 26, 26, 27, 28, 29, 13, 14, 15, 16, 16
Offset: 0

Views

Author

Rémy Sigrist, Jan 28 2020

Keywords

Comments

Every nonnegative integer appears in this sequence as A008578 is a complete sequence.
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

Examples

			For n = 43:
- 43 = 2^0 + 2^1 + 2^3 + 2^5,
- so a(43) = 2^0 + prime(1) + prime(3) + prime(5) = 1 + 2 + 5 + 11 = 19.
		

Crossrefs

Programs

  • Mathematica
    Array[Total@ Map[If[# == 0, 1, Prime[#]] &, Position[Reverse@ IntegerDigits[#, 2], 1][[All, 1]] - 1] &, 68] (* Michael De Vlieger, Jan 29 2020 *)
  • PARI
    a(n) = my (b=Vecrev(binary(n\2))); n%2 + sum(k=1, #b, if (b[k], prime(k), 0))
    
  • Python
    from sympy import prime
    def p(n): return prime(n) if n >= 1 else 1
    def a(n): return sum(p(i)*int(b) for i, b in enumerate(bin(n)[:1:-1]))
    print([a(n) for n in range(69)]) # Michael S. Branicky, Jun 13 2021

Formula

a(2*n) = A089625(n) for any n > 0.
a(2*n+1) = A089625(n) + 1 for any n > 0.
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

A368577 Irregular table T(n, k), n >= 0, k = 1..A036497(n), read by rows; the n-th row lists the numbers m such that A331835(m) = n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 16, 11, 12, 17, 13, 18, 14, 19, 20, 15, 21, 32, 22, 24, 33, 23, 25, 34, 64, 26, 35, 36, 65, 27, 28, 37, 66, 29, 38, 40, 67, 68, 30, 39, 41, 69, 128, 31, 42, 48, 70, 72, 129, 43, 44, 49, 71, 73, 130, 256, 45, 50, 74, 80, 131, 132, 257
Offset: 0

Views

Author

Rémy Sigrist, Dec 31 2023

Keywords

Comments

As a flat sequence, this is a permutation of the nonnegative integers (with inverse A368578).

Examples

			Table T(n, k) begins:
  n   n-th row
  --  ------------------
   0  0
   1  1
   2  2
   3  3, 4
   4  5
   5  6, 8
   6  7, 9
   7  10, 16
   8  11, 12, 17
   9  13, 18
  10  14, 19, 20
  11  15, 21, 32
  12  22, 24, 33
  13  23, 25, 34, 64
  14  26, 35, 36, 65
  15  27, 28, 37, 66
  16  29, 38, 40, 67, 68
		

Crossrefs

Programs

  • PARI
    \\ See Links section.

Formula

T(n, 1) = A345297(n).
T(n, A036497(n)) = A200947(n).
Showing 1-3 of 3 results.