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.

This page as a plain text file.
%I A372428 #22 Oct 19 2024 08:33:00
%S A372428 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 A372428 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 A372428 1,-9,1,0,4,-7,4,-9,0,6,4,6,7,-5,5,5,0,-8
%N A372428 Sum of binary indices of n minus sum of prime indices of n.
%C A372428 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 A372428 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 A372428 John Tyler Rascoe, <a href="/A372428/b372428.txt">Table of n, a(n) for n = 1..10000</a>
%F A372428 a(n) = A029931(n) - A056239(n).
%e A372428 The binary indices of 65 are {1,7}, and the prime indices are {3,6}, so a(65) = 8 - 9 = -1.
%t A372428 prix[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
%t A372428 bix[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
%t A372428 Table[Total[bix[n]]-Total[prix[n]],{n,100}]
%o A372428 (Python)
%o A372428 from itertools import count, islice
%o A372428 from sympy import sieve, factorint
%o A372428 def a_gen():
%o A372428     for n in count(1):
%o A372428         b = sum((i+1) for i, x in enumerate(bin(n)[2:][::-1]) if x =='1')
%o A372428         p = sum(sieve.search(i)[0] for i in factorint(n, multiple=True))
%o A372428         yield(b-p)
%o A372428 A372428_list = list(islice(a_gen(), 83)) # _John Tyler Rascoe_, May 04 2024
%o A372428 (Python)
%o A372428 from sympy import primepi, factorint
%o A372428 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 A372428 Positions of zeros are A372427.
%Y A372428 For minimum instead of sum we have A372437.
%Y A372428 For length instead of sum we have A372441, zeros A071814.
%Y A372428 For maximum instead of sum we have A372442, zeros A372436.
%Y A372428 Positions of odd terms are A372586, even A372587.
%Y A372428 A003963 gives product of prime indices.
%Y A372428 A019565 gives Heinz number of binary indices, adjoint A048675.
%Y A372428 A029837 gives greatest binary index, least A001511.
%Y A372428 A048793 lists binary indices, length A000120, reverse A272020, sum A029931.
%Y A372428 A061395 gives greatest prime index, least A055396.
%Y A372428 A070939 gives length of binary expansion.
%Y A372428 A096111 gives product of binary indices.
%Y A372428 A112798 lists prime indices, length A001222, reverse A296150, sum A056239.
%Y A372428 A326031 gives weight of the set-system with BII-number n.
%Y A372428 Cf. A000720, A001221, A014499, A030101, A059893, A066099, A243055, A304818, A359495, A372429-A372432.
%K A372428 sign,base
%O A372428 1,6
%A A372428 _Gus Wiseman_, May 02 2024