Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

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

JavaScript (ES6), 79 bytes

n=>[(n+=--n?n<4?33:n<12?43:n<56?53:n<71?90:n<88?39:n<103?76:25:17)/18|0,n%18+1]

Try it online! (raw output)

Try it online! (builds the periodic table)

Or 76 bytes if 0-indexing is acceptable:

n=>[(n+=--n?n<4?15:n<12?25:n<56?35:n<71?72:n<88?21:n<103?58:7:-1)/18|0,n%18]

Try it online!

JavaScript (ES6), 79 bytes

n=>[(n+=--n?n<4?33:n<12?43:n<56?53:n<71?90:n<88?39:n<103?76:25:17)/18|0,n%18+1]

Try it online! (raw output)

Try it online! (builds the periodic table)

JavaScript (ES6), 79 bytes

n=>[(n+=--n?n<4?33:n<12?43:n<56?53:n<71?90:n<88?39:n<103?76:25:17)/18|0,n%18+1]

Try it online! (raw output)

Try it online! (builds the periodic table)

Or 76 bytes if 0-indexing is acceptable:

n=>[(n+=--n?n<4?15:n<12?25:n<56?35:n<71?72:n<88?21:n<103?58:7:-1)/18|0,n%18]

Try it online!

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

JavaScript (ES6), 8079 bytes

n=>[-~((n+=--n?n<4?1533:n<12?2543:n<56?3553:n<71?7290:n<88?2139:n<103?5876:725:-117)/18)18|0,n%18+1]

Try it online! Try it online! (raw output)

Try it online! (builds the periodic table)

JavaScript (ES6), 80 bytes

n=>[-~((n+=--n?n<4?15:n<12?25:n<56?35:n<71?72:n<88?21:n<103?58:7:-1)/18),n%18+1]

Try it online!

JavaScript (ES6), 79 bytes

n=>[(n+=--n?n<4?33:n<12?43:n<56?53:n<71?90:n<88?39:n<103?76:25:17)/18|0,n%18+1]

Try it online! (raw output)

Try it online! (builds the periodic table)

Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (ES6), 80 bytes

n=>[-~((n+=--n?n<4?15:n<12?25:n<56?35:n<71?72:n<88?21:n<103?58:7:-1)/18),n%18+1]

Try it online!

AltStyle によって変換されたページ (->オリジナル) /