Skip to main content
Added explanation
Source Link
DLosc
  • 39.2k
  • 5
  • 83
  • 141

Python 2, 76 bytes

Inspired by ovs's Ruby answer.

n=0
while 1:
 i=t=1
 for d in`n`:t*=i>0;i+=int(d)-1
 if t>0==i:print n
 n+=1

Try it online!

Explanation

For each number n, we loop over each digit d in its string representation. Let i begin at 1; at each digit, add that digit to i and subtract 1. Then for a number to be fully matched, i should never drop below 1 until after the last digit, when it should be exactly 0.

d:  2 0 1 0
i: 1 2 1 1 0

The for loop on the fourth line performs these calculations, tracking whether i is always greater than 0 in t. After the loop, if t is still 1 and i is 0, we print the number.

Python 2, 76 bytes

Inspired by ovs's Ruby answer.

n=0
while 1:
 i=t=1
 for d in`n`:t*=i>0;i+=int(d)-1
 if t>0==i:print n
 n+=1

Try it online!

Python 2, 76 bytes

Inspired by ovs's Ruby answer.

n=0
while 1:
 i=t=1
 for d in`n`:t*=i>0;i+=int(d)-1
 if t>0==i:print n
 n+=1

Try it online!

Explanation

For each number n, we loop over each digit d in its string representation. Let i begin at 1; at each digit, add that digit to i and subtract 1. Then for a number to be fully matched, i should never drop below 1 until after the last digit, when it should be exactly 0.

d:  2 0 1 0
i: 1 2 1 1 0

The for loop on the fourth line performs these calculations, tracking whether i is always greater than 0 in t. After the loop, if t is still 1 and i is 0, we print the number.

Source Link
DLosc
  • 39.2k
  • 5
  • 83
  • 141

Python 2, 76 bytes

Inspired by ovs's Ruby answer.

n=0
while 1:
 i=t=1
 for d in`n`:t*=i>0;i+=int(d)-1
 if t>0==i:print n
 n+=1

Try it online!