login
Triangular numbers whose nonzero digits are all the same.
1

%I #45 Apr 09 2022 06:36:48

%S 0,1,3,6,10,55,66,300,666,990,3003,5050,10011,66066,500500,600060,

%T 50005000,5000050000,500000500000,50000005000000,5000000050000000,

%U 500000000500000000,50000000005000000000,5000000000050000000000,500000000000500000000000,50000000000005000000000000

%N Triangular numbers whose nonzero digits are all the same.

%C This sequence may correspond to "monochromatic step squads" in the British animation "Numberblocks".

%C Conjecture: the largest term in this sequence whose nonzero digits are not 5 is 600060.

%t (* Method1 *)

%t NonZeroQ[n_Integer] := n != 0; Select[

%t Table[n (n + 1)/2, {n, 0, 1000000}],

%t Length[Tally[Select[IntegerDigits[#], NonZeroQ]]] == 1 &]

%t (* Method2 *)

%t Sort[Select[

%t Flatten[Outer[Times,

%t Table[FromDigits[IntegerDigits[n, 2]], {n, 2^16 - 1}], Range[9]]],

%t IntegerQ[Sqrt[8 # + 1]] &]]

%o (Python)

%o from sympy import integer_nthroot

%o from sympy.utilities.iterables import multiset_permutations

%o def istri(n): return integer_nthroot(8*n+1, 2)[1]

%o def zplus1(digits):

%o if digits == 1: yield 0

%o for d1 in "123456789":

%o digset = "0"*(digits-1) + d1*(digits-1)

%o for mp in multiset_permutations(digset, digits-1):

%o t = int(d1 + "".join(mp))

%o yield t

%o def afind(maxdigits):

%o for digits in range(1, maxdigits+1):

%o for t in zplus1(digits):

%o if istri(t):

%o print(t, end=", ")

%o afind(22) # _Michael S. Branicky_, Mar 02 2022

%o (PARI) isok(k) = my(d=digits(k*(k+1)/2)); d = select(x->(x!=0), d); #Set(d)<=1;

%o lista(nn) = {for (n=0, nn, if (isok(n), print1(n*(n+1)/2, ", ")););} \\ _Michel Marcus_, Mar 02 2022

%Y Supersequence of A037156.

%Y Cf. A000217, A118668, A125289, A343811.

%Y Cf. A352148 (indices of these triangular numbers).

%K nonn,base

%O 1,3

%A _Steven Lu_, Mar 02 2022

%E a(24)-a(25) from _Michael S. Branicky_, Mar 02 2022