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 Question

Notice removed Reward existing answer by user
Bounty Ended with Aiden Chow's answer chosen by user
Notice added Reward existing answer by user
Bounty Started worth 500 reputation by user
Commonmark migration
Source Link

###Background:

Background:

The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely repost of the challenge.

##Challenge

Challenge

Given a positive integer through any standard input format, distinguish between whether it is perfect or not.

A perfect number is a number that is equal to the sum of all its proper divisors (its positive divisors less than itself). For example, \6ドル\$ is a perfect number, since its divisors are \1,2,3ドル\$, which sum up to \6ドル\$, while \12ドル\$ is not a perfect number since its divisors ( \1,2,3,4,6ドル\$ ) sum up to \16ドル\$, not \12ドル\$.

###Test Cases:

Test Cases:

Imperfect:
1,12,13,18,20,1000,33550335
Perfect:
6,28,496,8128,33550336,8589869056

Rules

  • Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time.
  • Output can be two distinct and consistent values through any allowed output format. If it isn't immediately obvious what represents Perfect/Imperfect, please make sure to specify in your answer.

###Background:

The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely repost of the challenge.

##Challenge

Given a positive integer through any standard input format, distinguish between whether it is perfect or not.

A perfect number is a number that is equal to the sum of all its proper divisors (its positive divisors less than itself). For example, \6ドル\$ is a perfect number, since its divisors are \1,2,3ドル\$, which sum up to \6ドル\$, while \12ドル\$ is not a perfect number since its divisors ( \1,2,3,4,6ドル\$ ) sum up to \16ドル\$, not \12ドル\$.

###Test Cases:

Imperfect:
1,12,13,18,20,1000,33550335
Perfect:
6,28,496,8128,33550336,8589869056

Rules

  • Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time.
  • Output can be two distinct and consistent values through any allowed output format. If it isn't immediately obvious what represents Perfect/Imperfect, please make sure to specify in your answer.

Background:

The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely repost of the challenge.

Challenge

Given a positive integer through any standard input format, distinguish between whether it is perfect or not.

A perfect number is a number that is equal to the sum of all its proper divisors (its positive divisors less than itself). For example, \6ドル\$ is a perfect number, since its divisors are \1,2,3ドル\$, which sum up to \6ドル\$, while \12ドル\$ is not a perfect number since its divisors ( \1,2,3,4,6ドル\$ ) sum up to \16ドル\$, not \12ドル\$.

Test Cases:

Imperfect:
1,12,13,18,20,1000,33550335
Perfect:
6,28,496,8128,33550336,8589869056

Rules

  • Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time.
  • Output can be two distinct and consistent values through any allowed output format. If it isn't immediately obvious what represents Perfect/Imperfect, please make sure to specify in your answer.
Tweeted twitter.com/StackCodeGolf/status/1105438448243097603
removed references to truthy/falsey
Source Link
Jo King
  • 48.1k
  • 6
  • 130
  • 187

###Background:

The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely repost of the challenge.

##Challenge

Given a positive integer through any standard input format, outputdistinguish between whether it is not perfect or not.

A perfect number is a number that is equal to the sum of all its proper divisors (its positive divisors less than itself). For example, \6ドル\$ is a perfect number, since its divisors are \1,2,3ドル\$, which sum up to \6ドル\$, while \12ドル\$ is not a perfect number since its divisors ( \1,2,3,4,6ドル\$ ) sum up to \16ドル\$, not \12ドル\$.

###Test Cases:

Imperfect:
1,12,13,18,20,1000,33550335
Perfect:
6,28,496,8128,33550336,8589869056

Rules

  • Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time.
  • Output can be two distinct and consistent values through any allowed output format. If it isn't immediately obvious what represents TruthyPerfect/FalseyImperfect, please make sure to specify in your answer.
  • This means your values don't have to be literally Truthy/Falsey. Your Truthy output may evaluate to false in your language and vice-versa.

###Background:

The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely repost of the challenge.

##Challenge

Given a positive integer through any standard input format, output whether it is not perfect.

A perfect number is a number that is equal to the sum of all its proper divisors (its positive divisors less than itself). For example, \6ドル\$ is a perfect number, since its divisors are \1,2,3ドル\$, which sum up to \6ドル\$, while \12ドル\$ is not a perfect number since its divisors ( \1,2,3,4,6ドル\$ ) sum up to \16ドル\$, not \12ドル\$.

###Test Cases:

Imperfect:
1,12,13,18,20,1000,33550335
Perfect:
6,28,496,8128,33550336,8589869056

Rules

  • Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time.
  • Output can be two distinct and consistent values through any allowed output format. If it isn't immediately obvious what represents Truthy/Falsey, please make sure to specify in your answer.
  • This means your values don't have to be literally Truthy/Falsey. Your Truthy output may evaluate to false in your language and vice-versa.

###Background:

The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely repost of the challenge.

##Challenge

Given a positive integer through any standard input format, distinguish between whether it is perfect or not.

A perfect number is a number that is equal to the sum of all its proper divisors (its positive divisors less than itself). For example, \6ドル\$ is a perfect number, since its divisors are \1,2,3ドル\$, which sum up to \6ドル\$, while \12ドル\$ is not a perfect number since its divisors ( \1,2,3,4,6ドル\$ ) sum up to \16ドル\$, not \12ドル\$.

###Test Cases:

Imperfect:
1,12,13,18,20,1000,33550335
Perfect:
6,28,496,8128,33550336,8589869056

Rules

  • Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time.
  • Output can be two distinct and consistent values through any allowed output format. If it isn't immediately obvious what represents Perfect/Imperfect, please make sure to specify in your answer.
Became Hot Network Question
renamed test cases
Source Link
Jo King
  • 48.1k
  • 6
  • 130
  • 187

###Background:

The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely repost of the challenge.

##Challenge

Given a positive integer through any standard input format, output whether it is not perfect.

A perfect number is a number that is equal to the sum of all its proper divisors (its positive divisors less than itself). For example, \6ドル\$ is a perfect number, since its divisors are \1,2,3ドル\$, which sum up to \6ドル\$, while \12ドル\$ is not a perfect number since its divisors ( \1,2,3,4,6ドル\$ ) sum up to \16ドル\$, not \12ドル\$.

###Test Cases:

TruthyImperfect:
1,12,13,18,20,1000,33550335
FalseyPerfect:
6,28,496,8128,33550336,8589869056

Rules

  • Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time.
  • Output can be two distinct and consistent values through any allowed output format. If it isn't immediately obvious what represents Truthy/Falsey, please make sure to specify in your answer.
  • This means your values don't have to be literally Truthy/Falsey. Your Truthy output may evaluate to false in your language and vice-versa.

###Background:

The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely repost of the challenge.

##Challenge

Given a positive integer through any standard input format, output whether it is not perfect.

A perfect number is a number that is equal to the sum of all its proper divisors (its positive divisors less than itself). For example, \6ドル\$ is a perfect number, since its divisors are \1,2,3ドル\$, which sum up to \6ドル\$, while \12ドル\$ is not a perfect number since its divisors ( \1,2,3,4,6ドル\$ ) sum up to \16ドル\$, not \12ドル\$.

###Test Cases:

Truthy:
1,12,13,18,20,1000,33550335
Falsey:
6,28,496,8128,33550336,8589869056

Rules

  • Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time.
  • Output can be two distinct and consistent values through any allowed output format. If it isn't immediately obvious what represents Truthy/Falsey, please make sure to specify in your answer.
  • This means your values don't have to be literally Truthy/Falsey. Your Truthy output may evaluate to false in your language and vice-versa.

###Background:

The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely repost of the challenge.

##Challenge

Given a positive integer through any standard input format, output whether it is not perfect.

A perfect number is a number that is equal to the sum of all its proper divisors (its positive divisors less than itself). For example, \6ドル\$ is a perfect number, since its divisors are \1,2,3ドル\$, which sum up to \6ドル\$, while \12ドル\$ is not a perfect number since its divisors ( \1,2,3,4,6ドル\$ ) sum up to \16ドル\$, not \12ドル\$.

###Test Cases:

Imperfect:
1,12,13,18,20,1000,33550335
Perfect:
6,28,496,8128,33550336,8589869056

Rules

  • Your program doesn't have to complete the larger test cases, if there's memory or time constraints, but it should be theoretically able to if it were given more memory/time.
  • Output can be two distinct and consistent values through any allowed output format. If it isn't immediately obvious what represents Truthy/Falsey, please make sure to specify in your answer.
  • This means your values don't have to be literally Truthy/Falsey. Your Truthy output may evaluate to false in your language and vice-versa.
Source Link
Jo King
  • 48.1k
  • 6
  • 130
  • 187
Loading

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