Skip to main content
saved 1 byte
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (V8),  60 59  5958 bytes

Prints the sequence 'forever' (that is, until the call stack overflows).

for(n=0;;)(g=d=>d&&n=0;g=d=>d&&!(n%d--)-~~(n+g)[d]+g(d);)g(++n)||print(n) 

Try it online!Try it online!

Commented

We use a recursive function which simultaneously counts the number of divisors and subtracts the sum of the digits.

for(n = 0;;) // start with n = 0 and// repeatinfinite foreverloop: ( n = 0; // start with n = //0 g = d => //  g is a recursive function taking a divisor d d && //  stop if d = 0 !(n % d--) - //  add 1 if d is a divisor of n ~~(n + g) //  coerce n to a string with some additional //  non-digit characters [d] + //  subtract the d-th digit (0 if out of bounds) g(d) ; //  add the result of a recursive call ) // g(++n) // increment n; initial call to g with d = n || print(n) // print n if the result is 0 

Python 3, 78 bytes

-1 thanks to @Mukundan314

A port of my initial JS code. Most probably sub-optimal.

f=lambda d,v:d and(n%d<1)-v%10+f(d-1,v//10) n=1 while 1:f(n,n)or print(n);n+=1 

Try it online!

JavaScript (V8),  60  59 bytes

Prints the sequence 'forever' (that is, until the call stack overflows).

for(n=0;;)(g=d=>d&&!(n%d--)-~~(n+g)[d]+g(d))(++n)||print(n) 

Try it online!

Commented

We use a recursive function which simultaneously counts the number of divisors and subtracts the sum of the digits.

for(n = 0;;) // start with n = 0 and repeat forever ( // g = d => // g is a recursive function taking a divisor d d && // stop if d = 0 !(n % d--) - // add 1 if d is a divisor of n ~~(n + g) // coerce n to a string with some additional // non-digit characters [d] + // subtract the d-th digit (0 if out of bounds) g(d)  // add the result of a recursive call )(++n) // increment n; initial call to g with d = n || print(n) // print n if the result is 0 

Python 3, 78 bytes

-1 thanks to @Mukundan314

A port of my initial JS code. Most probably sub-optimal.

f=lambda d,v:d and(n%d<1)-v%10+f(d-1,v//10) n=1 while 1:f(n,n)or print(n);n+=1 

Try it online!

JavaScript (V8),  60 59  58 bytes

Prints the sequence 'forever' (that is, until the call stack overflows).

for(n=0;g=d=>d&&!(n%d--)-~~(n+g)[d]+g(d);)g(++n)||print(n) 

Try it online!

Commented

We use a recursive function which simultaneously counts the number of divisors and subtracts the sum of the digits.

for( // infinite loop:  n = 0; // start with n = 0 g = d => //  g is a recursive function taking a divisor d d && //  stop if d = 0 !(n % d--) - //  add 1 if d is a divisor of n ~~(n + g) //  coerce n to a string with some additional //  non-digit characters [d] + //  subtract the d-th digit (0 if out of bounds) g(d); //  add the result of a recursive call ) // g(++n) // increment n; initial call to g with d = n || print(n) // print n if the result is 0 

Python 3, 78 bytes

-1 thanks to @Mukundan314

A port of my initial JS code. Most probably sub-optimal.

f=lambda d,v:d and(n%d<1)-v%10+f(d-1,v//10) n=1 while 1:f(n,n)or print(n);n+=1 

Try it online!

saved 1 byte
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (V8), 60 60  59 bytes

Prints the sequence 'forever' (that is, until the call stack overflows).

for(n=0;;)(g=v=>d&&g=d=>d&&!(n%d--)-v%10+g~~(v/10|0n+g)[d]+g(d))(d=++n++n)||print(n) 

Try it online!Try it online!

Commented

We use a recursive function which simultaneously counts the number of divisors and subtracts the sum of the digits.

for(n = 0;;)  // start with n = 0 and repeat forever (  // g = vd =>  // g is a recursive function taking va divisor d d &&  // stop if d = 0 !(n % d--) -  // add 1 if d is a divisor of n v % 10~~(n +  g) // subtractcoerce then leastto significanta decimalstring with some additional   // non-digit characters  [d] +  // subtract the d-th digit (0 if out of vbounds) g(vd) / 10 | 0)  // do aadd recursivethe callresult withof floor(va /recursive 10)call )(d = ++n)  // increment n; initial call to g with v = d = n || print(n)  // print n if the result is 0 

Python 3, 78 bytes

-1 thanks to @Mukundan314

A port of my JS codeinitial JS code. Most probably sub-optimal.

f=lambda d,v:d and(n%d<1)-v%10+f(d-1,v//10) n=1 while 1:f(n,n)or print(n);n+=1 

Try it online!

JavaScript (V8), 60 bytes

Prints the sequence 'forever' (that is, until the call stack overflows).

for(n=0;;)(g=v=>d&&!(n%d--)-v%10+g(v/10|0))(d=++n)||print(n) 

Try it online!

Commented

We use a recursive function which simultaneously counts the number of divisors and subtracts the sum of the digits.

for(n = 0;;)  // start with n = 0 and repeat forever (  // g = v =>  // g is a recursive function taking v d &&  // stop if d = 0 !(n % d--) -  // add 1 if d is a divisor of n v % 10 +  // subtract the least significant decimal // digit of v g(v / 10 | 0) // do a recursive call with floor(v / 10) )(d = ++n) // increment n; initial call to g with v = d = n || print(n)  // print n if the result is 0 

Python 3, 78 bytes

-1 thanks to @Mukundan314

A port of my JS code. Most probably sub-optimal.

f=lambda d,v:d and(n%d<1)-v%10+f(d-1,v//10) n=1 while 1:f(n,n)or print(n);n+=1 

Try it online!

JavaScript (V8),  60  59 bytes

Prints the sequence 'forever' (that is, until the call stack overflows).

for(n=0;;)(g=d=>d&&!(n%d--)-~~(n+g)[d]+g(d))(++n)||print(n) 

Try it online!

Commented

We use a recursive function which simultaneously counts the number of divisors and subtracts the sum of the digits.

for(n = 0;;) // start with n = 0 and repeat forever ( // g = d => // g is a recursive function taking a divisor d d && // stop if d = 0 !(n % d--) - // add 1 if d is a divisor of n ~~(n + g) // coerce n to a string with some additional   // non-digit characters  [d] +  // subtract the d-th digit (0 if out of bounds) g(d)   // add the result of a recursive call )(++n)  // increment n; initial call to g with d = n || print(n) // print n if the result is 0 

Python 3, 78 bytes

-1 thanks to @Mukundan314

A port of my initial JS code. Most probably sub-optimal.

f=lambda d,v:d and(n%d<1)-v%10+f(d-1,v//10) n=1 while 1:f(n,n)or print(n);n+=1 

Try it online!

added a commented version
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (V8), 60 bytes

Prints the sequence 'forever' (that is, until the call stack overflows).

for(n=0;;)(g=v=>d&&!(n%d--)-v%10+g(v/10|0))(d=++n)||print(n) 

Try it online!

Commented

We use a recursive function which simultaneously counts the number of divisors and subtracts the sum of the digits.

for(n = 0;;) // start with n = 0 and repeat forever ( // g = v => // g is a recursive function taking v d && // stop if d = 0 !(n % d--) - // add 1 if d is a divisor of n v % 10 + // subtract the least significant decimal // digit of v g(v / 10 | 0) // do a recursive call with floor(v / 10) )(d = ++n) // increment n; initial call to g with v = d = n || print(n) // print n if the result is 0 

Python 3, 78 bytes

-1 thanks to @Mukundan314

A port of my JS code. Most probably sub-optimal.

f=lambda d,v:d and(n%d<1)-v%10+f(d-1,v//10) n=1 while 1:f(n,n)or print(n);n+=1 

Try it online!

JavaScript (V8), 60 bytes

Prints the sequence 'forever' (that is, until the call stack overflows).

for(n=0;;)(g=v=>d&&!(n%d--)-v%10+g(v/10|0))(d=++n)||print(n) 

Try it online!


Python 3, 78 bytes

-1 thanks to @Mukundan314

A port of my JS code. Most probably sub-optimal.

f=lambda d,v:d and(n%d<1)-v%10+f(d-1,v//10) n=1 while 1:f(n,n)or print(n);n+=1 

Try it online!

JavaScript (V8), 60 bytes

Prints the sequence 'forever' (that is, until the call stack overflows).

for(n=0;;)(g=v=>d&&!(n%d--)-v%10+g(v/10|0))(d=++n)||print(n) 

Try it online!

Commented

We use a recursive function which simultaneously counts the number of divisors and subtracts the sum of the digits.

for(n = 0;;) // start with n = 0 and repeat forever ( // g = v => // g is a recursive function taking v d && // stop if d = 0 !(n % d--) - // add 1 if d is a divisor of n v % 10 + // subtract the least significant decimal // digit of v g(v / 10 | 0) // do a recursive call with floor(v / 10) )(d = ++n) // increment n; initial call to g with v = d = n || print(n) // print n if the result is 0 

Python 3, 78 bytes

-1 thanks to @Mukundan314

A port of my JS code. Most probably sub-optimal.

f=lambda d,v:d and(n%d<1)-v%10+f(d-1,v//10) n=1 while 1:f(n,n)or print(n);n+=1 

Try it online!

saved 1 byte
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670
Loading
added a Python version
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670
Loading
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670
Loading