Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

71%
+3 −0
Challenges Are they abundant, deficient or perfect?

Jelly, 6 bytes _ÆṣṠ)Ġ Try it online! In order of abundant, perfect, deficient. _ÆṣṠ)Ġ Main Link ) For each from 1 to N _ Subtract Æṣ The proper divisor sum Ṡ Sign ...

posted 3y ago by hyper-neutrino‭  ·  edited 3y ago by hyper-neutrino‭

Answer
#3: Post edited by user avatar hyper-neutrino‭ · 2021-06-16T15:12:49Z (over 3 years ago)
  • # [Jelly], 7 bytes
  • Æs_ḤṠ)Ġ
  • [Try it online!][TIO-kpzllyif]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kpzllyif]: https://tio.run/##y0rNyan8//9wW3H8wx1LHu5coHlkwf///w0NDAA "Jelly – Try It Online"
  • In order of deficient, perfect, abundant.
  • ```
  • Æs_Ṡ)Ġ Main Link
  • ) For each number from 1 to N
  • Æs Divisor sum
  • _ Subtract
  • Double the input (proper divisor sum is just divisor sum - input)
  • Ṡ Sign; -1 for deficient, 0 for perfect, 1 for abundant
  • Ġ Group equal elements' indices
  • ```
  • # [Jelly], 6 bytes
  • _ÆṣṠ)Ġ
  • [Try it online!][TIO-kpzm4bc4]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kpzm4bc4]: https://tio.run/##y0rNyan8/z/@cNvDnYsf7lygeWTB////DQ0MAA "Jelly – Try It Online"
  • In order of abundant, perfect, deficient.
  • ```
  • _ÆṣṠ)Ġ Main Link
  • ) For each from 1 to N
  • _ Subtract
  • Æṣ The proper divisor sum
  • Ṡ Sign of the difference
  • Ġ Group equal elements' indices
  • ```
#2: Post edited by user avatar hyper-neutrino‭ · 2021-06-16T15:03:24Z (over 3 years ago)
  • # [Jelly], 7 bytes
  • Æs_ḤṠ)Ġ
  • [Try it online!][TIO-kpzllyif]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kpzllyif]: https://tio.run/##y0rNyan8//9wW3H8wx1LHu5coHlkwf///w0NDAA "Jelly – Try It Online"
  • # [Jelly], 7 bytes
  • Æs_ḤṠ)Ġ
  • [Try it online!][TIO-kpzllyif]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kpzllyif]: https://tio.run/##y0rNyan8//9wW3H8wx1LHu5coHlkwf///w0NDAA "Jelly – Try It Online"
  • In order of deficient, perfect, abundant.
  • ```
  • Æs_ḤṠ)Ġ Main Link
  • ) For each number from 1 to N
  • Æs Divisor sum
  • _ Subtract
  • Ḥ Double the input (proper divisor sum is just divisor sum - input)
  • Ṡ Sign; -1 for deficient, 0 for perfect, 1 for abundant
  • Ġ Group equal elements' indices
  • ```
#1: Initial revision by user avatar hyper-neutrino‭ · 2021-06-16T14:57:36Z (over 3 years ago)
# [Jelly], 7 bytes

    Æs_ḤṠ)Ġ

[Try it online!][TIO-kpzllyif]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-kpzllyif]: https://tio.run/##y0rNyan8//9wW3H8wx1LHu5coHlkwf///w0NDAA "Jelly – Try It Online"