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

gave credit to dennis
Source Link
Neil A.
  • 2.1k
  • 8
  • 23

05AB1E, 7(削除) 7 (削除ここまで) 6 bytes

EDIT: Thanks to @Dennis: Saved a byte because I forgot about the increment operator

8*1+t8*>t

Try it online! Try it online!

n is triangular if sqrt(8n + 1) is an integer

How it works

8* # multiply implicit input by 8
 1+> # add one
 t # sqrt
 .ï # is integer

05AB1E, 7 bytes

8*1+t

Try it online!

n is triangular if sqrt(8n + 1) is an integer

How it works

8* # multiply implicit input by 8
 1+ # add one
 t # sqrt
 .ï # is integer

05AB1E, (削除) 7 (削除ここまで) 6 bytes

EDIT: Thanks to @Dennis: Saved a byte because I forgot about the increment operator

8*>t

Try it online!

n is triangular if sqrt(8n + 1) is an integer

How it works

8* # multiply implicit input by 8
 > # add one
 t # sqrt
 .ï # is integer
Source Link
Neil A.
  • 2.1k
  • 8
  • 23

05AB1E, 7 bytes

8*1+t.ï

Try it online!

n is triangular if sqrt(8n + 1) is an integer

How it works

8* # multiply implicit input by 8
 1+ # add one
 t # sqrt
 .ï # is integer

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