Skip to main content
make it work properly, oops
Source Link

JavaScript (Node.js), 120110 bytes

n=6;a="2";forn=6;a=[2];for(;n-->0;a=a.split("").reverse().reduce((v,e,i)=>v.concat(Array(e*1).fill(i+1)),[]).join(""));console.log(a.join(""))

Try it online!Try it online!

Set n at the start to change which element of the sequence is calculated.

Unfortunately, this is a rather long answer, due to JavaScript's wordy array operator functions.

JavaScript (Node.js), 120 bytes

n=6;a="2";for(;n-->0;a=a.split("").reverse().reduce((v,e,i)=>v.concat(Array(e*1).fill(i+1)),[]).join(""));console.log(a)

Try it online!

Set n at the start to change which element of the sequence is calculated.

Unfortunately, this is a rather long answer, due to JavaScript's wordy array operator functions.

JavaScript (Node.js), 110 bytes

n=6;a=[2];for(;n-->0;a=a.reverse().reduce((v,e,i)=>v.concat(Array(e*1).fill(i+1)),[]));console.log(a.join(""))

Try it online!

Set n at the start to change which element of the sequence is calculated.

Unfortunately, this is a rather long answer, due to JavaScript's wordy array operator functions.

fewer bytes again
Source Link

JavaScript (ES6Node.js), 139120 bytes

n=6;a=[2];whilen=6;a="2";for(n;n-->0){a=a.join("")>0;a=a.split("").reverse().reduce((v,e,i)=>v.concat(Array(parseInt(e)e*1).fill(i+1)),[])};console.log(a.join(""));console.log(a)

Try it online!Try it online!

Set n at the start to change which element of the sequence is calculated.

Unfortunately, this is a rather long answer, due to JavaScript's wordy array operator functions.

JavaScript (ES6), 139 bytes

n=6;a=[2];while(n-->0){a=a.join("").split("").reverse().reduce((v,e,i)=>v.concat(Array(parseInt(e)).fill(i+1)),[])};console.log(a.join(""))

Try it online!

Set n at the start to change which element of the sequence is calculated.

Unfortunately, this is a rather long answer, due to JavaScript's wordy array operator functions.

JavaScript (Node.js), 120 bytes

n=6;a="2";for(;n-->0;a=a.split("").reverse().reduce((v,e,i)=>v.concat(Array(e*1).fill(i+1)),[]).join(""));console.log(a)

Try it online!

Set n at the start to change which element of the sequence is calculated.

Unfortunately, this is a rather long answer, due to JavaScript's wordy array operator functions.

add tio link
Source Link

JavaScript (ES6), 144139 bytes

n=6;a=[2];forn=6;a=[2];while(j=0;j<n;j++n-->0){a=a.join("").split("").reverse().reduce((v,e,i)=>v.concat(Array(parseInt(e)).fill(i+1)),[])};console.log(a.join(""));

Try it online!

Set n at the start to change which element of the sequence is calculated.

Unfortunately, this is a rather long answer, due to JavaScript's wordy array operator functions.

JavaScript (ES6), 144 bytes

n=6;a=[2];for(j=0;j<n;j++){a=a.join("").split("").reverse().reduce((v,e,i)=>v.concat(Array(parseInt(e)).fill(i+1)),[])};console.log(a.join(""));

JavaScript (ES6), 139 bytes

n=6;a=[2];while(n-->0){a=a.join("").split("").reverse().reduce((v,e,i)=>v.concat(Array(parseInt(e)).fill(i+1)),[])};console.log(a.join(""))

Try it online!

Set n at the start to change which element of the sequence is calculated.

Unfortunately, this is a rather long answer, due to JavaScript's wordy array operator functions.

Source Link
Loading