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.

A278909 Binary Smith numbers: composite numbers n such that sum of bits of n = sum of bits of prime factors of n (counted with multiplicity).

This page as a plain text file.
%I A278909 #31 Apr 22 2021 21:54:40
%S A278909 15,51,55,85,125,159,185,190,205,215,222,238,246,249,253,287,303,319,
%T A278909 374,407,438,442,469,471,475,489,494,501,507,591,623,639,670,679,687,
%U A278909 699,730,745,755,763,765,771,799,807,822,830,843,867,890,893,917,923,925,935,939,951,970,973,979,986,989,995,1010,1015,1017,1020,1023,1135,1167,1203,1243
%N A278909 Binary Smith numbers: composite numbers n such that sum of bits of n = sum of bits of prime factors of n (counted with multiplicity).
%C A278909 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.)
%C A278909 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
%H A278909 Ely Golden, <a href="/A278909/b278909.txt">Table of n, a(n) for n = 1..10000</a>
%e A278909 a(1) = 15, as 15 (1111) in binary has the same number of 1 bits as its prime factors (11 and 101).
%t A278909 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 *)
%o A278909 (SageMath)
%o A278909 def numfactorbits(x):
%o A278909     if(x<2):
%o A278909         return 0;
%o A278909     s=0;
%o A278909     f=list(factor(x));
%o A278909     #ensures inequality of numfactorbits(x) and bin(x).count("1") if x is prime
%o A278909     if((len(f)==1)&(f[0][1]==1)):
%o A278909         return 0;
%o A278909     for c in range(len(f)):
%o A278909         s+=bin(f[c][0]).count("1")*f[c][1]
%o A278909     return s;
%o A278909 counter=2
%o A278909 index=1
%o A278909 while(index<=10000):
%o A278909     if(numfactorbits(counter)==bin(counter).count("1")):
%o A278909         print(str(index)+" "+str(counter))
%o A278909         index+=1;
%o A278909     counter+=1;
%o A278909 (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))
%o A278909 terms(n) = my(i=0); forcomposite(c=1, , if(is(c), print1(c, ", "); i++; if(i==n, break)))
%o A278909 /* Print initial 70 terms as follows: */
%o A278909 terms(70) \\ _Felix Fröhlich_, Dec 01 2016
%o A278909 (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
%o A278909 (Python)
%o A278909 from sympy import factorint
%o A278909 def sbd(n): return bin(n).count('1')
%o A278909 def ok(n):
%o A278909   f = factorint(n)
%o A278909   return sum(f[p] for p in f) > 1 and sbd(n) == sum(sbd(p)*f[p] for p in f)
%o A278909 print(list(filter(ok, range(1244)))) # _Michael S. Branicky_, Apr 22 2021
%Y A278909 Cf. A006753, A176670.
%K A278909 nonn,base,easy
%O A278909 1,1
%A A278909 _Ely Golden_, Nov 30 2016