A036518 Smallest triangular number containing exactly n 1's.
1, 171, 1711, 105111, 1188111, 18111171, 1111160511, 11161151121, 111111101310, 11311511141161, 121111912011111, 11111811011411671, 11101111131911151, 11111111111113201, 111111312111373411111, 1119711111215111121171, 111112117111126711111195, 1141011111112731111616111
Offset: 1
Programs
-
Mathematica
nsmall = Table[Infinity, 20]; For[i = 0, i <= 10^6, i++, p = PolygonalNumber[i]; n0 = Count[IntegerDigits[p], 1]; If[nsmall[[n0]] > p, nsmall[[n0]] = p]]; ReplaceAll[nsmall, Infinity -> "?"] (* Robert Price, Mar 22 2020 *) Module[{nn=5*10^6,tr},tr={#,DigitCount[#,10,1]}&/@Accumulate[Range[ nn]]; Table[ SelectFirst[tr,#[[2]]==k&],{k,10}]][[;;,1]] (* The program generates the first 10 terms of the sequence. *) (* Harvey P. Dale, Sep 01 2024 *)
Formula
Extensions
Definition clarified by Robert Israel, Aug 10 2014
a(15)-a(16) from A048356 by Michel Marcus, Aug 12 2014
a(17)-a(18) from Giovanni Resta, Oct 30 2019