%I #15 Aug 11 2022 08:53:46
%S 3,5,9,11,17,33,44,50,58,65,129,257,396,452,513,581,864,971,1025,1139,
%T 1843,1881,1914,2049,2541,2676,2929,3130,4097,4596,5254,6621,7010,
%U 7111,8193,10771,11140,12655,16385,17090,19135,19371,19580,20985,27117,27845,32769,35272,44278,46779,56069
%N Numbers k whose binary expansion is a substring of the binary expansion of binomial(k,2).
%C All numbers of the form 2^m+1, m>=1, are in the sequence. There are 152 terms below 100 million.
%e 9 is a term as 9 = 1001_2 and binomial(9,2) = 9!/(2!7!) = 36 = 100100_2 and "100100" contains "1001" as a substring.
%t kmax=56100; a={}; For[k=1, k<=kmax, k++, If[StringContainsQ[ToString[FromDigits[IntegerDigits[Binomial[k, 2], 2]]], ToString[FromDigits[IntegerDigits[k,2]]]], AppendTo[a, k]]]; a (* _Stefano Spezia_, Aug 11 2022 *)
%o (PARI) str(k) = Str(fromdigits(binary(k)));
%o isok(k) = #strsplit(str(binomial(k,2)), str(k)) > 1; \\ _Michel Marcus_, Aug 11 2022
%o (Python)
%o from math import comb
%o def ok(n): return n > 0 and str(bin(n)[2:]) in str(bin(comb(n, 2))[2:])
%o print([k for k in range(10**5) if ok(k)]) # _Michael S. Branicky_, Aug 11 2022
%Y Cf. A000217, A187752, A030190, A351753.
%K nonn,base
%O 1,1
%A _Scott R. Shannon_, Aug 11 2022
|