3 added 32 characters in body
source | link

Challenge

Your task in this question is to write a program or a named function which takes inputa positive integer n (greater than 0) as input via STDIN,ARGV ARGV or function arguments and outputs an array via STDOUT or function returned value.

Sounds simple enough ? Now here are the rules

  • The array will only contain integers from 1 to n
  • Each integer from 1 to n should be repeated x times where x is the value of each integer.

For example:

Input:

5

Output:

[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]

The array may or may not be sorted.

This is so winner is shortest code in bytes.

Bonus

Multiply your score by 0.5 if no two adjacent integers in your output array are same.

For example for n = 5, one such configuration would be

[5, 4, 5, 4, 3, 4, 5, 2, 5, 3, 1, 2, 3, 4, 5]

Challenge

Your task in this question is to write a program or a named function which takes input integer n via STDIN,ARGV or function arguments and outputs an array via STDOUT or function returned value.

Sounds simple enough ? Now here are the rules

  • The array will only contain integers from 1 to n
  • Each integer from 1 to n should be repeated x times where x is the value of each integer.

For example:

Input:

5

Output:

[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]

The array may or may not be sorted.

This is so winner is shortest code in bytes.

Bonus

Multiply your score by 0.5 if no two adjacent integers in your output array are same.

For example for n = 5, one such configuration would be

[5, 4, 5, 4, 3, 4, 5, 2, 5, 3, 1, 2, 3, 4, 5]

Challenge

Your task in this question is to write a program or a named function which takes a positive integer n (greater than 0) as input via STDIN, ARGV or function arguments and outputs an array via STDOUT or function returned value.

Sounds simple enough ? Now here are the rules

  • The array will only contain integers from 1 to n
  • Each integer from 1 to n should be repeated x times where x is the value of each integer.

For example:

Input:

5

Output:

[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]

The array may or may not be sorted.

This is so winner is shortest code in bytes.

Bonus

Multiply your score by 0.5 if no two adjacent integers in your output array are same.

For example for n = 5, one such configuration would be

[5, 4, 5, 4, 3, 4, 5, 2, 5, 3, 1, 2, 3, 4, 5]
    Tweeted twitter.com/#!/StackCodeGolf/status/546015629913096193
2 added 8 characters in body
source | link

Challenge

Your task in this question is to write a program or a named function which takes input integer n via STDIN,ARGV or function arguments and outputs an array via STDOUT or function returned value.

Sounds simple enough ? Now here are the rules

  • The array will only contain integers from 1 to n
  • Each integer from 1 to n should be repeated x times where x is the value of each integer.

For example:

Input:

5

Output:

[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]

The array may or may not be sorted.

This is so winner is shortest code in bytes.

Bonus

Multiply your score by 0.5 if no two adjacent integers in your output array are same.

For example for n = 5, one such configuration would be

[5, 4, 5, 4, 3, 4, 5, 2, 5, 3, 1, 2, 3, 4, 5]

Challenge

Your task in this question is to write a program or function which takes input integer n via STDIN,ARGV or function arguments and outputs an array via STDOUT or function returned value.

Sounds simple enough ? Now here are the rules

  • The array will only contain integers from 1 to n
  • Each integer from 1 to n should be repeated x times where x is the value of each integer.

For example:

Input:

5

Output:

[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]

The array may or may not be sorted.

This is so winner is shortest code in bytes.

Bonus

Multiply your score by 0.5 if no two adjacent integers in your output array are same.

For example for n = 5, one such configuration would be

[5, 4, 5, 4, 3, 4, 5, 2, 5, 3, 1, 2, 3, 4, 5]

Challenge

Your task in this question is to write a program or a named function which takes input integer n via STDIN,ARGV or function arguments and outputs an array via STDOUT or function returned value.

Sounds simple enough ? Now here are the rules

  • The array will only contain integers from 1 to n
  • Each integer from 1 to n should be repeated x times where x is the value of each integer.

For example:

Input:

5

Output:

[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]

The array may or may not be sorted.

This is so winner is shortest code in bytes.

Bonus

Multiply your score by 0.5 if no two adjacent integers in your output array are same.

For example for n = 5, one such configuration would be

[5, 4, 5, 4, 3, 4, 5, 2, 5, 3, 1, 2, 3, 4, 5]
1
source | link

Create an array with repeated numbers

Challenge

Your task in this question is to write a program or function which takes input integer n via STDIN,ARGV or function arguments and outputs an array via STDOUT or function returned value.

Sounds simple enough ? Now here are the rules

  • The array will only contain integers from 1 to n
  • Each integer from 1 to n should be repeated x times where x is the value of each integer.

For example:

Input:

5

Output:

[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]

The array may or may not be sorted.

This is so winner is shortest code in bytes.

Bonus

Multiply your score by 0.5 if no two adjacent integers in your output array are same.

For example for n = 5, one such configuration would be

[5, 4, 5, 4, 3, 4, 5, 2, 5, 3, 1, 2, 3, 4, 5]