login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A037308 Numbers whose base-2 and base-10 expansions have the same digit sum. 19

%I #42 Jun 21 2021 02:47:13

%S 0,1,20,21,122,123,202,203,222,223,230,231,302,303,410,411,502,503,

%T 1130,1131,1150,1151,1202,1203,1212,1213,1230,1231,1300,1301,1402,

%U 1403,1502,1503,1510,1511,2006,2007,2032,2033,2102,2103,2200,2201,3006,3007,3012

%N Numbers whose base-2 and base-10 expansions have the same digit sum.

%C n is in the sequence iff n+(-1)^n is in the sequence. [_Robert Israel_, Mar 25 2013]

%H Charles R Greathouse IV, <a href="/A037308/b037308.txt">Table of n, a(n) for n = 1..10000</a>

%F From _Reinhard Zumkeller_, Aug 06 2010: (Start)

%F A007953(a(n)) = A000120(a(n));

%F A180018(a(n)) = 0. (End)

%e 122 is a member, since digital-sum_2(122) = 5 = digital-sum_10(122).

%p N:= 10000; # to get all elements up to N

%p select(x -> (convert(convert(x,base,10),`+`)-convert(convert(x,base,2),`+`)=0), [$0..N]); # _Robert Israel_, Mar 25 2013

%t Select[Range[0, 5000], Total[IntegerDigits[#, 2]] == Total[IntegerDigits[#, 10]] &] (* _Jean-François Alcover_, Mar 07 2016 *)

%o (PARI) is(n)=hammingweight(n)==sumdigits(n); \\ _Charles R Greathouse IV_, Sep 25 2012

%o (Sage) [n for n in (0..10000) if sum(n.digits(base=2)) == sum(n.digits(base=10))] # _Freddy Barrera_, Oct 12 2018

%o (Python)

%o def ok(n): return sum(map(int, str(n))) == sum(map(int, bin(n)[2:]))

%o print(list(filter(ok, range(3013)))) # _Michael S. Branicky_, Jun 20 2021

%Y Cf. A000040, A000120, A007953, A054899, A131451, A133620, A133900, A134599, A135110, A180018.

%K nonn,base

%O 1,3

%A _Clark Kimberling_

%E Edited by _N. J. A. Sloane_ Nov 29 2008 at the suggestion of _Zak Seidov_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)