A356537 Numbers k whose binary expansion is a substring of the binary expansion of binomial(k,2).
3, 5, 9, 11, 17, 33, 44, 50, 58, 65, 129, 257, 396, 452, 513, 581, 864, 971, 1025, 1139, 1843, 1881, 1914, 2049, 2541, 2676, 2929, 3130, 4097, 4596, 5254, 6621, 7010, 7111, 8193, 10771, 11140, 12655, 16385, 17090, 19135, 19371, 19580, 20985, 27117, 27845, 32769, 35272, 44278, 46779, 56069
Offset: 1
Examples
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.
Programs
-
Mathematica
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 *)
-
PARI
str(k) = Str(fromdigits(binary(k))); isok(k) = #strsplit(str(binomial(k,2)), str(k)) > 1; \\ Michel Marcus, Aug 11 2022
-
Python
from math import comb def ok(n): return n > 0 and str(bin(n)[2:]) in str(bin(comb(n, 2))[2:]) print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Aug 11 2022
Comments