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.

A340161 a(n) is the smallest number k for which the set {k + 1, k + 2, ..., k + k} contains exactly n elements with exactly three 1-bits (A014311).

This page as a plain text file.
%I A340161 #37 Mar 11 2025 04:26:02
%S A340161 1,4,6,7,10,11,13,18,19,21,25,34,35,37,41,49,66,67,69,73,81,97,130,
%T A340161 131,133,137,145,161,193,258,259,261,265,273,289,321,385,514,515,517,
%U A340161 521,529,545,577,641,769,1026,1027,1029,1033,1041,1057,1089,1153,1281,1537
%N A340161 a(n) is the smallest number k for which the set {k + 1, k + 2, ..., k + k} contains exactly n elements with exactly three 1-bits (A014311).
%C A340161 When n = m*(m-1)/2 + 1, m >= 2 (A000124 \ {1}), then a(n) = k = 2^m+2, m >= 2 (A052548 \ {3, 4}), and only for these values of k, there exists only one set, {k+1, k+2, ..., 2k}, that contains exactly n elements whose binary representation has exactly three 1's (see A340068). - _Bernard Schott_, Jan 03 2021
%C A340161 From _David A. Corneth_, Jan 03 2021: (Start)
%C A340161 a(n) = A018900(n) + 1 for n >= 1.
%C A340161 Proof: Let T(k) be the number of values in {k+1, k+2, ..., k+k} that have exactly 3 ones in their binary expansion. Let h(k) be 1 if k has exactly 3 ones in its binary expansion and 0 otherwise and let w(k) be the binary weight of k (cf. A000120). Then T(k + 1) = T(k) + h(2*k + 1) + h(2*k + 2) - h(k + 1) = T(k) + h(2*k + 1) + h(2*(k + 1)) - h(k + 1) but as h(2^m * k) = h(k) two terms cancel and we have T(k + 1) = T(k) + h(2*k + 1). If w(2*k + 1) = w(k) + 1 = 3 then w(k) = 2 which holds for k in A018900. (End)
%F A340161 From _Bernard Schott_, Jan 03 2021: (Start)
%F A340161 a(m*(m-1)/2 + 1) = 2^m + 2 for m >= 2.
%F A340161 a(m*(m-1)/2 + 2) = 2^m + 3 for m >= 2.
%F A340161 a(n) = A018900(n) + 1 for n >= 1 (see A340068). (End)
%e A340161 For k in {1, 2, 3}, the sets are {1, 2}, {3, 4} and {4, 5, 6}, which do not contain numbers in A014311, so a(0) = 1.
%e A340161 For k = 4, the set is {5, 6, 7, 8} with 7 = A014311(1), so a(1) = 4.
%e A340161 For k = 6, the set {7, 8, 9, 10, 11, 12} contains the elements 7 = A014311(1) and 11 = A014311(2), so a(2) = 6.
%o A340161 (Magma) fb:=func<n|(Multiplicity(Intseq(n,2),1)) eq 3>; a:=[]; for n in [0..64] do k:=1; while #[s:s in [k+1..2*k]|fb(s)] ne n do k:=k+1; end while; Append(~a,k); end for; a;
%o A340161 (PARI) first(n) = {my(res = vector(n), t = 1); res[1] = 1; for(i = 2, oo, if(hammingweight(2*i-1) == 3, t++; if(t > n, return(res)); res[t] = i))} \\ _David A. Corneth_, Jan 03 2021
%o A340161 (Python)
%o A340161 from math import isqrt, comb
%o A340161 def A340161(n): return 1+(1<<(m:=isqrt(n<<3)+1>>1))+(1<<(n-1-comb(m,2))) if n else 1 # _Chai Wah Wu_, Mar 10 2025
%Y A340161 Essentially a duplicate of A018900 - _N. J. A. Sloane_, Jan 23 2021.
%Y A340161 Cf. A014311, A340068.
%Y A340161 Cf. also A000124, A052548 \ {3} (is a subsequence).
%K A340161 nonn,easy,base
%O A340161 0,2
%A A340161 _Marius A. Burtea_, Dec 30 2020