A014311 Numbers with exactly 3 ones in binary expansion.
7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 67, 69, 70, 73, 74, 76, 81, 82, 84, 88, 97, 98, 100, 104, 112, 131, 133, 134, 137, 138, 140, 145, 146, 148, 152, 161, 162, 164, 168, 176, 193, 194, 196, 200, 208, 224, 259, 261, 262, 265, 266, 268, 273, 274, 276, 280, 289, 290, 292, 296, 304
Offset: 1
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- Robert Baillie, Summing the curious series of Kempner and Irwin, arXiv:0806.4410 [math.CA], 2008-2015. See p. 18 for Mathematica code irwinSums.m.
- Stephen Morley, HAKMEM Item 175 (Gosper).
- Tilman Piesk, First 56 elements in a tetrahedral array.
Crossrefs
Cf. A057168.
Cf. A000079, A018900, A014311, A014312, A014313, A023688, A023689, A023690, A023691 (Hammingweight = 1, 2, ..., 9).
A000217(n-2) counts compositions into three parts.
A337453 is the strict case.
A337461 counts the coprime case.
A033992 lists numbers divisible by exactly three different primes.
A323024 lists numbers with exactly three different prime multiplicities.
Programs
-
C
unsigned hakmem175(unsigned x) { unsigned s, o, r; s = x & -x; r = x + s; o = r ^ x; o = (o >> 2) / s; return r | o; } unsigned A014311(int n) { if (n == 1) return 7; return hakmem175(A014311(n - 1)); } // Peter Luschny, Jan 01 2014
-
Haskell
a014311 n = a014311_list !! (n-1) a014311_list = [2^x + 2^y + 2^z | x <- [2..], y <- [1..x-1], z <- [0..y-1]] -- Reinhard Zumkeller, May 03 2012
-
Mathematica
Select[Range[200], (Count[IntegerDigits[#, 2], 1] == 3)&] nn = 8; Flatten[Table[2^i + 2^j + 2^k, {i, 2, nn}, {j, 1, i - 1}, {k, 0, j - 1}]] (* T. D. Noe, Nov 05 2013 *)
-
PARI
for(n=0,10^3,if(hammingweight(n)==3,print1(n,", "))); \\ Joerg Arndt, Mar 04 2014
-
PARI
print1(t=7);for(i=2,50,print1(","t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
-
Python
A014311_list = [2**a+2**b+2**c for a in range(2,6) for b in range(1,a) for c in range(b)] # Chai Wah Wu, Jan 24 2021
-
Python
from itertools import islice def A014311_gen(): # generator of terms yield (n:=7) while True: yield (n:=n^((a:=-n&n+1)|(a>>1)) if n&1 else ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b) A014311_list = list(islice(A014311_gen(),20)) # Chai Wah Wu, Mar 10 2025
-
Python
from math import isqrt, comb from sympy import integer_nthroot def A014311(n): return (1<<(r:=n-1-comb((m:=integer_nthroot(6*n,3)[0])+(t:=(n>comb(m+2,3)))+1,3))-comb((k:=isqrt(b:=r+1<<1))+(b>k*(k+1)),2))+(1<<(a:=isqrt(s:=n-comb(m-(t^1)+2,3)<<1))+((s<<2)>(a<<2)*(a+1)+1))+(1<
Chai Wah Wu, Mar 10 2025
Formula
A000120(a(n)) = 3. - Reinhard Zumkeller, May 03 2012
Start with A084468. If n is in sequence, then 2n is too. - Ralf Stephan, Aug 16 2013
a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
Sum_{n>=1} 1/a(n) = A367110 = 1.428591545852638123996854844400537952781688750906133068397189529775365950039... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022
Extensions
Extension and program by Olivier Gérard
Comments