Skip to main content
added 284 characters in body
Source Link
Katenkyo
  • 3.1k
  • 14
  • 29

Semiperfect numbers

A semiperfect/pseudoperfect number is an integer equal to the sum of a part of or all of its divisors (excluding itself). Numbers which are equal to the sum of all of their divisors are perfect.

Divisors of 6 : 1,2,3
      6 = 1+2+3 -> semiperfect (perfect)
Divisors of 28 : 1,2,4,7,14
      28 = 14+7+4+2+1 -> semiperfect (perfect)
Divisors of 40 : 1,2,4,5,8,10,20
      40 = 1+4+5+10+20 or 2+8+10+20 -> semiperfect

Primitive

A primitive semiperfect number is a semiperfect number with no semiperfect divisors (except itself :))
Divisors of 6 : 1,2,3
      6  = 1+2+3 -> primitive
Divisors of 12 : 1,2,3,4,6
      12 = 2+4+6 -> semiperfect

As references, please use the OEIS series A006036 for primitive semiperfect numbers, and A005835 for semiperfects.

Goal

Write a program or a function in any language. It will take as input a number n as a function parameter or from STDIN/your language's closest alternative, and will output all the primitive semi-perfect numbers from 1 to n (inclusive).

The output must be formated as 6[separator]20[separator]28[separator]88... where [separator] is either as newline, a space or a comma. There must not be a starting [separator] nor a ending one.

Edit : you can leave a trailing newline

Examples

input :

5

output :

input :

20

output :

6
20

input :

100

output :

6 20 28 88

Scoring

This is code-golf, so the shortest code in bytes win.

Don't try to fool us with loopholes please :).

I'd be glad you could leave an explanation of your golfed code once you think you're done golfing it!

As this challenge already have some nice answers, and is slowly getting quiet, I'll put an end to it. The winner of this code-golf will be decided on Monday 29th, 00:00 GMT. Well done to all of you that have answered, and good luck to those who will try to beat them :)

Semiperfect numbers

A semiperfect/pseudoperfect number is an integer equal to the sum of a part of or all of its divisors (excluding itself). Numbers which are equal to the sum of all of their divisors are perfect.

Divisors of 6 : 1,2,3
      6 = 1+2+3 -> semiperfect (perfect)
Divisors of 28 : 1,2,4,7,14
      28 = 14+7+4+2+1 -> semiperfect (perfect)
Divisors of 40 : 1,2,4,5,8,10,20
      40 = 1+4+5+10+20 or 2+8+10+20 -> semiperfect

Primitive

A primitive semiperfect number is a semiperfect number with no semiperfect divisors (except itself :))
Divisors of 6 : 1,2,3
      6  = 1+2+3 -> primitive
Divisors of 12 : 1,2,3,4,6
      12 = 2+4+6 -> semiperfect

As references, please use the OEIS series A006036 for primitive semiperfect numbers, and A005835 for semiperfects.

Goal

Write a program or a function in any language. It will take as input a number n as a function parameter or from STDIN/your language's closest alternative, and will output all the primitive semi-perfect numbers from 1 to n (inclusive).

The output must be formated as 6[separator]20[separator]28[separator]88... where [separator] is either as newline, a space or a comma. There must not be a starting [separator] nor a ending one.

Edit : you can leave a trailing newline

Examples

input :

5

output :

input :

20

output :

6
20

input :

100

output :

6 20 28 88

Scoring

This is code-golf, so the shortest code in bytes win.

Don't try to fool us with loopholes please :).

I'd be glad you could leave an explanation of your golfed code once you think you're done golfing it!

Semiperfect numbers

A semiperfect/pseudoperfect number is an integer equal to the sum of a part of or all of its divisors (excluding itself). Numbers which are equal to the sum of all of their divisors are perfect.

Divisors of 6 : 1,2,3
      6 = 1+2+3 -> semiperfect (perfect)
Divisors of 28 : 1,2,4,7,14
      28 = 14+7+4+2+1 -> semiperfect (perfect)
Divisors of 40 : 1,2,4,5,8,10,20
      40 = 1+4+5+10+20 or 2+8+10+20 -> semiperfect

Primitive

A primitive semiperfect number is a semiperfect number with no semiperfect divisors (except itself :))
Divisors of 6 : 1,2,3
      6  = 1+2+3 -> primitive
Divisors of 12 : 1,2,3,4,6
      12 = 2+4+6 -> semiperfect

As references, please use the OEIS series A006036 for primitive semiperfect numbers, and A005835 for semiperfects.

Goal

Write a program or a function in any language. It will take as input a number n as a function parameter or from STDIN/your language's closest alternative, and will output all the primitive semi-perfect numbers from 1 to n (inclusive).

The output must be formated as 6[separator]20[separator]28[separator]88... where [separator] is either as newline, a space or a comma. There must not be a starting [separator] nor a ending one.

Edit : you can leave a trailing newline

Examples

input :

5

output :

input :

20

output :

6
20

input :

100

output :

6 20 28 88

Scoring

This is code-golf, so the shortest code in bytes win.

Don't try to fool us with loopholes please :).

I'd be glad you could leave an explanation of your golfed code once you think you're done golfing it!

As this challenge already have some nice answers, and is slowly getting quiet, I'll put an end to it. The winner of this code-golf will be decided on Monday 29th, 00:00 GMT. Well done to all of you that have answered, and good luck to those who will try to beat them :)

Tweeted twitter.com/#!/StackCodeGolf/status/612553246188683264
Corrected some grammar
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119

Semiperfect numbers

A semiperfect/pseudoperfect number is a numberan integer equal to the sum of a part of or all of its divisordivisors (excluding selfitself). Numbers Numbers which are equalsequal to the sum of all of their divisors are perfect.

 Divisors of 6 : 1,2,3
      6 = 1+2+3 -> semiperfect (perfect)
 Divisors of 28 : 1,2,4,7,14
      28 = 14+7+4+2+1 -> semiperfect (perfect)
 Divisors of 40 : 1,2,4,5,8,10,20
      40 = 1+4+5+10+20 or 2+8+10+20 -> semiperfect

Primitive

A primitive semiperfect number, is a semiperfect number with no semiperfect divisors (except selfitself :))
Divisors of 6 : 1,2,3
      6  = 1+2+3 -> primitive
Divisors of 12 : 1,2,3,4,6
      12 = 2+4+6 -> semiperfect

As references, please use the OEIS serieseries A006036 for primitive semiperfect numbers, and A005835 for semiperfects.

Goal

Write a program or a function inin any language. It will take as input a number n from as a parameter (if function), parameter or stdinfrom STDIN/ your languageyour language's closest alternative, and will output all the primitive semi-perfect numbers from 1 to n (inclusive).

The output must be formated as 6[separator]20[separator]28[separator]88... where [separator] is either as newline, a space or a comma. There must not be a starting [separator] nor a ending one.

Edit : you can leave a trailing newline

Examples

input :

5

output :

input :

20

output :

6
20

input :

100

output :

6 20 28 88

Scoring

This is code-golf, so the shortest code in bytebytes win.

Don't try to fool us with loopholes please :).

I'd be glad you could leave an explanation of your golfed code once you think you're done golfing it  !

Semiperfect numbers

A semiperfect/pseudoperfect number is a number equal to the sum of a part or all of its divisor (excluding self). Numbers which are equals to all of their divisors are perfect.

 Divisors of 6 : 1,2,3
      6 = 1+2+3 -> semiperfect (perfect)
 Divisors of 28 : 1,2,4,7,14
      28 = 14+7+4+2+1 -> semiperfect (perfect)
 Divisors of 40 : 1,2,4,5,8,10,20
      40 = 1+4+5+10+20 or 2+8+10+20 -> semiperfect

Primitive

A primitive semiperfect number, is a semiperfect number with no semiperfect divisors (except self :))
Divisors of 6 : 1,2,3
      6  = 1+2+3 -> primitive
Divisors of 12 : 1,2,3,4,6
      12 = 2+4+6 -> semiperfect

As references, please use the OEIS serie A006036 for primitive semiperfect numbers, and A005835 for semiperfects.

Goal

Write a program or a function in any language. It will take as input a number n from as a parameter (if function), or stdin/ your language closest alternative, and will output all the primitive semi-perfect numbers from 1 to n (inclusive).

The output must be formated as 6[separator]20[separator]28[separator]88... where [separator] is either as newline, a space or a comma. There must not be a starting [separator] nor a ending one.

Edit : you can leave a trailing newline

Examples

input :

5

output :

input :

20

output :

6
20

input :

100

output :

6 20 28 88

Scoring

This is code-golf, so the shortest code in byte win.

Don't try to fool with loopholes please :).

I'd be glad you leave an explanation of your golfed code once you think you're done golfing it  !

Semiperfect numbers

A semiperfect/pseudoperfect number is an integer equal to the sum of a part of or all of its divisors (excluding itself). Numbers which are equal to the sum of all of their divisors are perfect.

Divisors of 6 : 1,2,3
      6 = 1+2+3 -> semiperfect (perfect)
Divisors of 28 : 1,2,4,7,14
      28 = 14+7+4+2+1 -> semiperfect (perfect)
Divisors of 40 : 1,2,4,5,8,10,20
      40 = 1+4+5+10+20 or 2+8+10+20 -> semiperfect

Primitive

A primitive semiperfect number is a semiperfect number with no semiperfect divisors (except itself :))
Divisors of 6 : 1,2,3
      6  = 1+2+3 -> primitive
Divisors of 12 : 1,2,3,4,6
      12 = 2+4+6 -> semiperfect

As references, please use the OEIS series A006036 for primitive semiperfect numbers, and A005835 for semiperfects.

Goal

Write a program or a function in any language. It will take as input a number n as a function parameter or from STDIN/your language's closest alternative, and will output all the primitive semi-perfect numbers from 1 to n (inclusive).

The output must be formated as 6[separator]20[separator]28[separator]88... where [separator] is either as newline, a space or a comma. There must not be a starting [separator] nor a ending one.

Edit : you can leave a trailing newline

Examples

input :

5

output :

input :

20

output :

6
20

input :

100

output :

6 20 28 88

Scoring

This is code-golf, so the shortest code in bytes win.

Don't try to fool us with loopholes please :).

I'd be glad you could leave an explanation of your golfed code once you think you're done golfing it!

added 31 characters in body
Source Link
Katenkyo
  • 3.1k
  • 14
  • 29

Semiperfect numbers

A semiperfect/pseudoperfect number is a number equal to the sum of a part or all of its divisor (excluding self). Numbers which are equals to all of their divisors are perfect.

 Divisors of 6 : 1,2,3
      6 = 1+2+3 -> semiperfect (perfect)
 Divisors of 28 : 1,2,4,7,14
      28 = 14+7+4+2+1 -> semiperfect (perfect)
 Divisors of 40 : 1,2,4,5,8,10,20
      40 = 1+4+5+10+20 or 2+8+10+20 -> semiperfect

Primitive

A primitive semiperfect number, is a semiperfect number with no semiperfect divisors (except self :))
Divisors of 6 : 1,2,3
      6  = 1+2+3 -> primitive
Divisors of 12 : 1,2,3,4,6
      12 = 2+4+6 -> semiperfect

As references, please use the OEIS serie A006036 for primitive semiperfect numbers, and A005835 for semiperfects.

Goal

Write a program or a function in any language. It will take as input a number n from stdinas a parameter (if function), or stdin/ your language closest alternative, and will output all the primitive semi-perfect numbers from 1 to n (inclusive).

The output must be formated as 6[separator]20[separator]28[separator]88... where [separator] is either as newline, a space or a comma. There must not be a starting [separator] nor a ending one.

Edit : you can leave a trailing newline

Examples

input :

5

output :

input :

20

output :

6
20

input :

100

output :

6 20 28 88

Scoring

This is code-golf, so the shortest code in byte win.

Don't try to fool with loopholes please :).

I'd be glad you leave an explanation of your golfed code once you think you're done golfing it !

Semiperfect numbers

A semiperfect/pseudoperfect number is a number equal to the sum of a part or all of its divisor (excluding self). Numbers which are equals to all of their divisors are perfect.

 Divisors of 6 : 1,2,3
      6 = 1+2+3 -> semiperfect (perfect)
 Divisors of 28 : 1,2,4,7,14
      28 = 14+7+4+2+1 -> semiperfect (perfect)
 Divisors of 40 : 1,2,4,5,8,10,20
      40 = 1+4+5+10+20 or 2+8+10+20 -> semiperfect

Primitive

A primitive semiperfect number, is a semiperfect number with no semiperfect divisors (except self :))
Divisors of 6 : 1,2,3
      6  = 1+2+3 -> primitive
Divisors of 12 : 1,2,3,4,6
      12 = 2+4+6 -> semiperfect

As references, please use the OEIS serie A006036 for primitive semiperfect numbers, and A005835 for semiperfects.

Goal

Write a program or a function in any language. It will take as input a number n from stdin or your language closest alternative, and will output all the primitive semi-perfect numbers from 1 to n (inclusive).

The output must be formated as 6[separator]20[separator]28[separator]88... where [separator] is either as newline, a space or a comma. There must not be a starting [separator] nor a ending one.

Edit : you can leave a trailing newline

Examples

input :

5

output :

input :

20

output :

6
20

input :

100

output :

6 20 28 88

Scoring

This is code-golf, so the shortest code in byte win.

Don't try to fool with loopholes please :).

I'd be glad you leave an explanation of your golfed code once you think you're done golfing it !

Semiperfect numbers

A semiperfect/pseudoperfect number is a number equal to the sum of a part or all of its divisor (excluding self). Numbers which are equals to all of their divisors are perfect.

 Divisors of 6 : 1,2,3
      6 = 1+2+3 -> semiperfect (perfect)
 Divisors of 28 : 1,2,4,7,14
      28 = 14+7+4+2+1 -> semiperfect (perfect)
 Divisors of 40 : 1,2,4,5,8,10,20
      40 = 1+4+5+10+20 or 2+8+10+20 -> semiperfect

Primitive

A primitive semiperfect number, is a semiperfect number with no semiperfect divisors (except self :))
Divisors of 6 : 1,2,3
      6  = 1+2+3 -> primitive
Divisors of 12 : 1,2,3,4,6
      12 = 2+4+6 -> semiperfect

As references, please use the OEIS serie A006036 for primitive semiperfect numbers, and A005835 for semiperfects.

Goal

Write a program or a function in any language. It will take as input a number n from as a parameter (if function), or stdin/ your language closest alternative, and will output all the primitive semi-perfect numbers from 1 to n (inclusive).

The output must be formated as 6[separator]20[separator]28[separator]88... where [separator] is either as newline, a space or a comma. There must not be a starting [separator] nor a ending one.

Edit : you can leave a trailing newline

Examples

input :

5

output :

input :

20

output :

6
20

input :

100

output :

6 20 28 88

Scoring

This is code-golf, so the shortest code in byte win.

Don't try to fool with loopholes please :).

I'd be glad you leave an explanation of your golfed code once you think you're done golfing it !

added 47 characters in body
Source Link
Katenkyo
  • 3.1k
  • 14
  • 29
Loading
edited tags
Link
Katenkyo
  • 3.1k
  • 14
  • 29
Loading
Source Link
Katenkyo
  • 3.1k
  • 14
  • 29
Loading