OFFSET
1,1
COMMENTS
Binary equivalent of A006753 as well as A176670. (Since bits can only be 0 or 1, having equal sums of bits is logically equivalent to having the same nonzero bits.)
There are 615 terms up to 10^4, 6412 up to 10^5, 66369 up to 10^6, 630106 up to 10^7, 6268949 up to 10^8, 62159262 up to 10^9, and 596587090 up to 10^10. - Charles R Greathouse IV, Dec 09 2016
LINKS
Ely Golden, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = 15, as 15 (1111) in binary has the same number of 1 bits as its prime factors (11 and 101).
MATHEMATICA
Select[Range@ 1250, And[CompositeQ@ #, DigitCount[#, 2, 1] = Total@ Flatten@ Apply[DigitCount[#, 2, 1] & /@ ConstantArray[#1, #2] &, FactorInteger@ #, 1]] &] (* Michael De Vlieger, Dec 02 2016 *)
PROG
(SageMath)
def numfactorbits(x):
if(x<2):
return 0;
s=0;
f=list(factor(x));
#ensures inequality of numfactorbits(x) and bin(x).count("1") if x is prime
if((len(f)==1)&(f[0][1]==1)):
return 0;
for c in range(len(f)):
s+=bin(f[c][0]).count("1")*f[c][1]
return s;
counter=2
index=1
while(index<=10000):
if(numfactorbits(counter)==bin(counter).count("1")):
print(str(index)+" "+str(counter))
index+=1;
counter+=1;
(PARI) is(n) = my(f=factor(n)[, 1]~, expo=factor(n)[, 2]~, v=[], s=0); for(k=1, #f, while(expo[k] > 0, expo[k]--; v=concat(v, f[k]))); for(k=1, #v, v[k]=binary(v[k])); my(w=[]); for(y=1, #v, w=concat(w, v[y])); if(vecsum(w)==vecsum(binary(n)), return(1), return(0))
terms(n) = my(i=0); forcomposite(c=1, , if(is(c), print1(c, ", "); i++; if(i==n, break)))
/* Print initial 70 terms as follows: */
terms(70) \\ Felix Fröhlich, Dec 01 2016
(PARI) is(n)=my(f=factor(n), t=#f~); (t>1 || (t==1 && f[1, 2]>1)) && hammingweight(n)==sum(i=1, t, hammingweight(f[i, 1])*f[i, 2]) \\ Charles R Greathouse IV, Dec 02 2016
(Python)
from sympy import factorint
def sbd(n): return bin(n).count('1')
def ok(n):
f = factorint(n)
return sum(f[p] for p in f) > 1 and sbd(n) == sum(sbd(p)*f[p] for p in f)
print(list(filter(ok, range(1244)))) # Michael S. Branicky, Apr 22 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Ely Golden, Nov 30 2016
STATUS
approved