login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A077436 Let B(n) be the sum of binary digits of n. This sequence contains n such that B(n) = B(n^2). 24

%I

%S 0,1,2,3,4,6,7,8,12,14,15,16,24,28,30,31,32,48,56,60,62,63,64,79,91,

%T 96,112,120,124,126,127,128,157,158,159,182,183,187,192,224,240,248,

%U 252,254,255,256,279,287,314,316,317,318,319,351,364,365,366,374,375,379,384

%N Let B(n) be the sum of binary digits of n. This sequence contains n such that B(n) = B(n^2).

%C Superset of A023758.

%C A159918(a(n)) = A000120(a(n)). - _Reinhard Zumkeller_, Apr 25 2009

%C Hare, Laishram, & Stoll show that this sequence contains infinitely many odd numbers. In particular for each k in {12, 13, 16, 17, 18, 19, 20, ...} there are infinitely many terms in this sequence with binary digit sum k. - _Charles R Greathouse IV_, Aug 25 2015

%H Reinhard Zumkeller, <a href="/A077436/b077436.txt">Table of n, a(n) for n = 1..10476, all terms <= 2^20</a>

%H K. G. Hare, S. Laishram, and T. Stoll, <a href="http://arxiv.org/abs/1001.4170">The sum of digits of n and n^2</a>, International Journal of Number Theory 7:7 (2011), pp. 1737-1752.

%H Giuseppe Melfi, <a href="http://www.arXiv.org/abs/math.NT/0402458">On simultaneous binary expansions of n and n^2</a>, arXiv:math/0402458 [math.NT], 2004.

%H Giuseppe Melfi, <a href="http://melfi.150m.com/presentazione.pdf">Su alcune successioni di interi</a> (English with an Italian title)

%e The element 79 belongs to the sequence because 79=(1001111) and 79^2=(1100001100001), so B(79)=B(79^2)

%p select(t -> convert(convert(t,base,2),`+`) = convert(convert(t^2,base,2),`+`), [$0..1000]); # _Robert Israel_, Aug 27 2015

%t t={}; Do[If[DigitCount[n, 2, 1] == DigitCount[n^2, 2, 1], AppendTo[t, n]], {n, 0, 364}]; t

%t f[n_] := Total@ IntegerDigits[n, 2]; Select[Range[0, 384], f@ # == f[#^2] &] (* _Michael De Vlieger_, Aug 27 2015 *)

%o (Haskell)

%o import Data.List (elemIndices)

%o import Data.Function (on)

%o a077436 n = a077436_list !! (n-1)

%o a077436_list = elemIndices 0

%o $ zipWith ((-) `on` a000120) [0..] a000290_list

%o -- _Reinhard Zumkeller_, Apr 12 2011

%o (PARI) is(n)=hammingweight(n)==hammingweight(n^2) \\ _Charles R Greathouse IV_, Aug 25 2015

%o (MAGMA) [n: n in [0..400] | &+Intseq(n, 2) eq &+Intseq(n^2, 2)]; // _Vincenzo Librandi_, Aug 30 2015

%Y Cf. A058369, A000120, A000290, A083567, A211676 (number of n-bit numbers in this sequence).

%Y A261586 is a subsequence.

%K easy,nonn,base

%O 1,3

%A _Giuseppe Melfi_, Nov 30 2002

%E Initial 0 added by _Reinhard Zumkeller_, Apr 28 2012, Apr 12 2011

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 26 17:16 EDT 2020. Contains 334630 sequences. (Running on oeis4.)