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.

A372428 Sum of binary indices of n minus sum of prime indices of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 3, 2, 4, 5, 1, -1, 2, 0, 3, 3, 4, 2, 4, 4, 4, 6, 6, 3, 8, 4, 1, 0, 0, 2, 3, -2, 2, 4, 4, -2, 5, -1, 6, 7, 5, 1, 5, 4, 6, 5, 6, -1, 9, 9, 8, 6, 6, 1, 11, 1, 8, 13, 1, -1, 1, -9, 1, 0, 4, -7, 4, -9, 0, 6, 4, 6, 7, -5, 5, 5, 0, -8
Offset: 1

Views

Author

Gus Wiseman, May 02 2024

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.
A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798.

Examples

			The binary indices of 65 are {1,7}, and the prime indices are {3,6}, so a(65) = 8 - 9 = -1.
		

Crossrefs

Positions of zeros are A372427.
For minimum instead of sum we have A372437.
For length instead of sum we have A372441, zeros A071814.
For maximum instead of sum we have A372442, zeros A372436.
Positions of odd terms are A372586, even A372587.
A003963 gives product of prime indices.
A019565 gives Heinz number of binary indices, adjoint A048675.
A029837 gives greatest binary index, least A001511.
A048793 lists binary indices, length A000120, reverse A272020, sum A029931.
A061395 gives greatest prime index, least A055396.
A070939 gives length of binary expansion.
A096111 gives product of binary indices.
A112798 lists prime indices, length A001222, reverse A296150, sum A056239.
A326031 gives weight of the set-system with BII-number n.

Programs

  • Mathematica
    prix[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    bix[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    Table[Total[bix[n]]-Total[prix[n]],{n,100}]
  • Python
    from itertools import count, islice
    from sympy import sieve, factorint
    def a_gen():
        for n in count(1):
            b = sum((i+1) for i, x in enumerate(bin(n)[2:][::-1]) if x =='1')
            p = sum(sieve.search(i)[0] for i in factorint(n, multiple=True))
            yield(b-p)
    A372428_list = list(islice(a_gen(), 83)) # John Tyler Rascoe, May 04 2024
    
  • Python
    from sympy import primepi, factorint
    def A372428(n): return int(sum(i for i, j in enumerate(bin(n)[:1:-1],1) if j=='1')-sum(primepi(p)*e for p, e in factorint(n).items())) # Chai Wah Wu, Oct 18 2024

Formula

a(n) = A029931(n) - A056239(n).