- 14.2k
- 1
- 62
- 117
Jelly, 4 bytes
BTịD
Try it online , code that computes the \$n\$th term of the sequence, or Try it onlinecheck the first 100 terms!
How it works:
B convert number to binary, i.e. 5 -> [1, 0, 1]
T keep the indices of the Truthy elements, i.e. [1, 0, 1] -> [1, 3]
ị and then index safely into...
D the decimal digits of the input number
By "index safely" I mean that indices out of range are automatically converted into the correct range!
Jelly, 4 bytes
BTịD
How it works:
B convert number to binary, i.e. 5 -> [1, 0, 1]
T keep the indices of the Truthy elements, i.e. [1, 0, 1] -> [1, 3]
ị and then index safely into...
D the decimal digits of the input number
By "index safely" I mean that indices out of range are automatically converted into the correct range!
Jelly, 4 bytes
BTịD
Try it online , code that computes the \$n\$th term of the sequence, or check the first 100 terms!
How it works:
B convert number to binary, i.e. 5 -> [1, 0, 1]
T keep the indices of the Truthy elements, i.e. [1, 0, 1] -> [1, 3]
ị and then index safely into...
D the decimal digits of the input number
By "index safely" I mean that indices out of range are automatically converted into the correct range!
Jelly, 4 bytes
BTịD
How it works:
B convert number to binary, i.e. 5 -> [1, 0, 1]
T keep the indices of the Truthy elements, i.e. [1, 0, 1] -> [1, 3]
ị and then index safely into...
D the decimal digits of the input number
By "index safely" I mean that indices out of range are automatically converted into the correct range!
Jelly, 4 bytes
BTịD
How it works:
B convert number to binary, i.e. 5 -> [1, 0, 1]
T keep the indices of the Truthy elements, i.e. [1, 0, 1] -> [1, 3]
ị and then index safely into...
D the decimal digits of the input number
By "index safely" I mean that indices out of range are automatically converted into the correct range!