login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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

%I #22 Oct 19 2024 08:33:00

%S 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,

%T 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,

%U 1,-9,1,0,4,-7,4,-9,0,6,4,6,7,-5,5,5,0,-8

%N Sum of binary indices of n minus sum of prime indices of n.

%C 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.

%C 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.

%H John Tyler Rascoe, <a href="/A372428/b372428.txt">Table of n, a(n) for n = 1..10000</a>

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

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

%t prix[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];

%t bix[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];

%t Table[Total[bix[n]]-Total[prix[n]],{n,100}]

%o (Python)

%o from itertools import count, islice

%o from sympy import sieve, factorint

%o def a_gen():

%o for n in count(1):

%o b = sum((i+1) for i, x in enumerate(bin(n)[2:][::-1]) if x =='1')

%o p = sum(sieve.search(i)[0] for i in factorint(n, multiple=True))

%o yield(b-p)

%o A372428_list = list(islice(a_gen(), 83)) # _John Tyler Rascoe_, May 04 2024

%o (Python)

%o from sympy import primepi, factorint

%o 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

%Y Positions of zeros are A372427.

%Y For minimum instead of sum we have A372437.

%Y For length instead of sum we have A372441, zeros A071814.

%Y For maximum instead of sum we have A372442, zeros A372436.

%Y Positions of odd terms are A372586, even A372587.

%Y A003963 gives product of prime indices.

%Y A019565 gives Heinz number of binary indices, adjoint A048675.

%Y A029837 gives greatest binary index, least A001511.

%Y A048793 lists binary indices, length A000120, reverse A272020, sum A029931.

%Y A061395 gives greatest prime index, least A055396.

%Y A070939 gives length of binary expansion.

%Y A096111 gives product of binary indices.

%Y A112798 lists prime indices, length A001222, reverse A296150, sum A056239.

%Y A326031 gives weight of the set-system with BII-number n.

%Y Cf. A000720, A001221, A014499, A030101, A059893, A066099, A243055, A304818, A359495, A372429-A372432.

%K sign,base

%O 1,6

%A _Gus Wiseman_, May 02 2024