login
A080472
a(n) = smallest triangular number that is obtained by placing digits anywhere in n; a(n) = n if n is a triangular number.
1
1, 21, 3, 45, 15, 6, 78, 28, 91, 10, 171, 120, 136, 1431, 15, 136, 171, 1081, 190, 120, 21, 1225, 231, 2145, 253, 276, 276, 28, 2926, 300, 231, 325, 3003, 2346, 325, 36, 378, 378, 3916, 406, 741, 4278, 435, 4465, 45, 406, 4278, 1485, 496, 1540, 351, 528, 153, 1540
OFFSET
1,2
LINKS
PROG
(Python)
from math import isqrt
from itertools import count
def dmo(n, t):
if t < n: return False
while n and t:
if n%10 == t%10:
n //= 10
t //= 10
return n == 0
def a(n):
return next(t for t in (i*(i+1)//2 for i in count(isqrt(2*n))) if dmo(n, t))
print([a(n) for n in range(1, 77)]) # Michael S. Branicky, Jan 21 2023
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Mar 07 2003
EXTENSIONS
More terms from Ray Chandler, Oct 11 2003
STATUS
approved