A261593 Odd numbers n such that the sum of the binary digits of n and n^2 both equal 12.
4095, 10239, 11263, 12159, 12223, 12255, 12271, 12279, 12283, 14333, 15351, 15355, 15743, 15807, 18431, 19455, 19967, 20351, 20477, 22015, 22495, 22511, 24031, 24303, 24431, 24445, 25599, 26615, 26621, 27519, 27631, 27639, 28095, 28411, 28413, 28511, 28541, 28575
Offset: 1
Examples
4095 = 111111111111_2 and 4095^2 = 111111111110000000000001_2 both have 12 1s in binary.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..1329
- K. G. Hare, S. Laishram, and T. Stoll, The sum of digits of n and n^2, International Journal of Number Theory 7:7 (2011), pp. 1737-1752.
Programs
-
Mathematica
Select[2 Range@ 15000 - 1, Total@ IntegerDigits[#, 2] == 12 && Total@ IntegerDigits[#^2, 2] == 12 &] (* Michael De Vlieger, Aug 27 2015 *)
-
PARI
is(n)=n%2 && hammingweight(n)==12 && hammingweight(n^2)==12
-
PARI
\\ List the elements below 2^(N+1). go(N)=my(v=List(),n); forvec(u=vector(11,i,[1,N-11+i]), n=sum(i=1,11,2^u[i])+1; if(hammingweight(n^2)==12, listput(v,n)), 2); Set(v)
-
Python
from itertools import combinations A261593_list = [] for c in combinations((2**x for x in range(15)),11): n = sum(c) if sum(int(d) for d in format(n*(n+1),'b')) == 11: A261593_list.append(2*n+1) A261593_list = sorted(A261593_list) # Chai Wah Wu, Aug 26 2015
Comments