Post Reopened by primo, Cruncher, Peter Taylor, Doorknob, ace
9 edited tags; edited tags
| link
    Post Closed as "off-topic" by Peter Taylor, Timtech, Justin, John Dvorak, WolframH
8 edited title
source | link

Minimum number used for having Generate lists in which every sublist has a unique element in all subsequence in a list

The problem is defined as follows:

Create a function that takes an integer and returns a list of integers, with the following properties:

  • Given a positive integer input, n, it produces a list containing n integers.integers ≥ 1.
  • Any sublist of the output must contain at least one unique element, which is different from all other elements from the same sublist. Sublist refers to a contiguous section of the original list; for example, [1,2,3] has sublists [1], [2], [3], [1,2], [2,3], and [1,2,3].
  • The list returned must be the lexicographically smallest list possible.

There is only one valid such list for every input. The first few are:

f(2) = [1,2]         2 numbers used
f(3) = [1,2,1]       2 numbers used
f(4) = [1,2,1,3]     3 numbers used

Minimum number used for having a unique element in all subsequence in a list

The problem is defined as follows:

Create a function that takes an integer and returns a list of integers, with the following properties:

  • Given a positive integer input, n, it produces a list containing n integers.
  • Any sublist of the output must contain at least one unique element, which is different from all other elements from the same sublist. Sublist refers to a contiguous section of the original list; for example, [1,2,3] has sublists [1], [2], [3], [1,2], [2,3], and [1,2,3].
  • The list returned must be the lexicographically smallest list possible.

The first few are:

f(2) = [1,2]         2 numbers used
f(3) = [1,2,1]       2 numbers used
f(4) = [1,2,1,3]     3 numbers used

Generate lists in which every sublist has a unique element

The problem is defined as follows:

Create a function that takes an integer and returns a list of integers, with the following properties:

  • Given a positive integer input, n, it produces a list containing n integers ≥ 1.
  • Any sublist of the output must contain at least one unique element, which is different from all other elements from the same sublist. Sublist refers to a contiguous section of the original list; for example, [1,2,3] has sublists [1], [2], [3], [1,2], [2,3], and [1,2,3].
  • The list returned must be the lexicographically smallest list possible.

There is only one valid such list for every input. The first few are:

f(2) = [1,2]         2 numbers used
f(3) = [1,2,1]       2 numbers used
f(4) = [1,2,1,3]     3 numbers used
7 use more conventional notation
source | link

The problem is defined as follows:

Create a function f::Int->[Int]that takes an integer and returns a list of integers, with the following properties:

  • Given a positive integer input, n, it produces a list containing n integers.
  • Any sublist of the output must contain at least one unique element, which is different from all other elements from the same sublist. Sublist means that onlySublist refers to a continuouscontiguous section of the original list,list; for example, [1,2,3] have sublisthas sublists [1],[2] [2],[3] [3],[1 [1,2],[2 [2,3],[1 and [1,2,3]  .
  • The list returned must be the lexicographically smallest list possible, orthographically speaking.

The first few are:

f(2)->[1 = [1,2]         2 numbers used
f(3)->[1 = [1,2,1]       2 numbers used
f(4)->[1 = [1,2,1,3]     3 numbers used

The problem is defined as follows:

Create a function f::Int->[Int], with the following properties:

  • Given a positive integer input, n, it produces a list containing n integers.
  • Any sublist of the output must contain at least one unique element, which is different from all other elements from the same sublist. Sublist means that only a continuous section of the original list, for example [1,2,3] have sublist [1],[2],[3],[1,2],[2,3],[1,2,3]  
  • The list returned must be the smallest list possible, orthographically speaking.

The first few are:

f(2)->[1,2]         2 numbers used
f(3)->[1,2,1]       2 numbers used
f(4)->[1,2,1,3]     3 numbers used

The problem is defined as follows:

Create a function that takes an integer and returns a list of integers, with the following properties:

  • Given a positive integer input, n, it produces a list containing n integers.
  • Any sublist of the output must contain at least one unique element, which is different from all other elements from the same sublist. Sublist refers to a contiguous section of the original list; for example, [1,2,3] has sublists [1], [2], [3], [1,2], [2,3], and [1,2,3].
  • The list returned must be the lexicographically smallest list possible.

The first few are:

f(2) = [1,2]         2 numbers used
f(3) = [1,2,1]       2 numbers used
f(4) = [1,2,1,3]     3 numbers used
    Tweeted twitter.com/#!/StackCodeGolf/status/429291261011705857
6 edited body
source | link
5 edited body
source | link
4 added 183 characters in body
source | link
3 added 44 characters in body
source | link
2 deleted 8 characters in body
source | link
1
source | link