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 »
Sandbox

Comments on Multiplicative perfection [FINALIZED]

Post

Multiplicative perfection [FINALIZED]

+0
−0

Now posts: Multiplicative perfection


Given a positive integer, indicate whether it is the product of its proper divisors.

Integers equal to the product of their proper divisors can be found on the Online Encyclopedia of Integer Sequences as the Multiplicatively perfect numbers.

Input

  • A positive integer N.

Output

  • One of 2 distinct values to indicate whether N is equal to the product of its proper divisors (that is, the product of all positive integers strictly less than N that divide exactly into N).
  • Note that the input 1 counts as the product of its proper divisors, despite having no proper divisors. The product of an empty set of numbers is 1.

Examples

Input Proper divisors Product Input = Product ?
1 - 1 true
6 1, 2, 3 6 true
8 1, 2, 4 8 true
9 1, 3 3 false
11 1 1 false
12 1, 2, 3, 4, 6 144 false

Test cases

Test cases are in the format input : output.

Note that the outputs can be any 2 distinct values. They do not have to be true and false.

1 : true
2 : false
3 : false
4 : false
5 : false
6 : true
7 : false
8 : true
9 : false
10 : true
11 : false
12 : false
13 : false
14 : true
15 : true
16 : false
17 : false
18 : false
19 : false
20 : false
21 : true
22 : true
23 : false
24 : false
25 : false
26 : true
27 : true
28 : false
29 : false
30 : false
31 : false
32 : false
33 : true
34 : true
35 : true
36 : false
37 : false
38 : true
39 : true
40 : false
41 : false
42 : false
43 : false
44 : false
45 : false
46 : true
47 : false
48 : false
49 : false
50 : false
51 : true
52 : false
53 : false
54 : false
55 : true
56 : false
57 : true
58 : true
59 : false
60 : false
61 : false
62 : true
63 : false
64 : false
65 : true
66 : false
67 : false
68 : false
69 : true
70 : false
71 : false
72 : false
73 : false
74 : true
75 : false
76 : false
77 : true
78 : false
79 : false
80 : false
81 : false
82 : true
83 : false
84 : false
85 : true
86 : true
87 : true
88 : false
89 : false
90 : false
91 : true
92 : false
93 : true
94 : true
95 : true
96 : false
97 : false
98 : false
99 : false

Scoring

This is a code golf challenge. Your score is the number of bytes in your code. Lowest score for each language wins.

Explanations are optional, but I'm more likely to upvote answers that have one.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Proper divisors (2 comments)
Proper divisors
Shaggy‭ wrote 3 months ago

Using the term "proper divisors" rather than "strict factors" would make this challenge clearer.

trichoplax‭ wrote 3 months ago

Thanks for the feedback. I should have noticed that when I found the OEIS entry. I've replaced all occurrences now.