[Question]
  [
My wife is very, let's say, particular when it comes to putting ornaments on our Christmas tree. Let's get her some code to help her in this trying time.
### Input
Given an input `2 < n < 10` the height of the tree and `0 < k < n` the distinct number of ornaments.
### Task
Decorate the tree starting with `1` and increment to `k` as we wrap the ornaments around the tree. If we reach `k` and we have more branches to decorate then start back at `1`.
It is okay if there are not the same number of each ornament on the tree, as long as the pattern is satisfied.
The ornaments should appear above each branch `^` except for the top row.
The tree is structured by starting with one branch then the next level has + 1 branches with a space between each, staggered from the top like:
```
 ^
^ ^
```
For a third row you would add one more branch and stagger them again such that no branch is on the same column (if you think of it like a grid).
```
  ^
 ^ ^
^ ^ ^
```
### Output
Output your decorated tree.
### Examples
### 1.
 `n = 3, k = 2` 
```
  ^      //Height is 3
 ^ ^
^ ^ ^
```
Now we decorate each branch starting with 1 and increment to k:
```
  ^
 1 2
 ^ ^
1 2 1
^ ^ ^
```
### 2.
 `n = 6, k = 5` 
```
     ^    //Non-Decorated
    ^ ^
   ^ ^ ^
  ^ ^ ^ ^
 ^ ^ ^ ^ ^
^ ^ ^ ^ ^ ^
     ^    //Decorated
    1 2
    ^ ^
   3 4 5
   ^ ^ ^
  1 2 3 4
  ^ ^ ^ ^
 5 1 2 3 4
 ^ ^ ^ ^ ^
5 1 2 3 4 5
^ ^ ^ ^ ^ ^
```
### 3.
`n = 5, k = 1` 
```
    ^
   ^ ^
  ^ ^ ^
 ^ ^ ^ ^
^ ^ ^ ^ ^
    ^
   1 1
   ^ ^
  1 1 1
  ^ ^ ^
 1 1 1 1
 ^ ^ ^ ^
1 1 1 1 1
^ ^ ^ ^ ^
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the shortest code wins! Have fun and good luck!
  
[Answer]
# C# 226 221 Bytes
*Saved 5 Bytes thanks to @Mukul Kumar and @aloisdg*
Golfed:
```
string C(int n,int k){string o="",x;int j=1,i=1,m;for(;i<=n;i++){o+=string.Concat(Enumerable.Repeat("^ ",i)).PadLeft(n+i)+"\n";m=0;x="";if(i<n){while(m<i+1){if(j>k)j=1;x+=j+++" ";m++;}o+=x.PadLeft(n+i+1)+"\n";}}return o;}
```
Ungolfed:
```
public string C(int n, int k, WifeMode wifeMode = WifeMode.Maniacal)
{
  string o = "",x;
  int j = 1,i=1,m;
  for (; i <= n; i++)
  {
    o += string.Concat(Enumerable.Repeat("^ ", i)).PadLeft(n+i) + "\n";
    m = 0;
    x = "";
    if (i < n)
    {
      while (m < i + 1)
      {
        if (j > k) j = 1;
        x += j++ + " ";
        m++;
      }
      o += x.PadLeft(n + i + 1) + "\n";
    }
  }
  return o;
}
```
Testing:
```
Console.Write(new ChristmasTreeDecorating().C(20, 9));
                   ^ 
                  1 2 
                  ^ ^ 
                 3 4 5 
                 ^ ^ ^ 
                6 7 8 9 
                ^ ^ ^ ^ 
               1 2 3 4 5 
               ^ ^ ^ ^ ^ 
              6 7 8 9 1 2 
              ^ ^ ^ ^ ^ ^ 
             3 4 5 6 7 8 9 
             ^ ^ ^ ^ ^ ^ ^ 
            1 2 3 4 5 6 7 8 
            ^ ^ ^ ^ ^ ^ ^ ^ 
           9 1 2 3 4 5 6 7 8 
           ^ ^ ^ ^ ^ ^ ^ ^ ^ 
          9 1 2 3 4 5 6 7 8 9 
          ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
         1 2 3 4 5 6 7 8 9 1 2 
         ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
        3 4 5 6 7 8 9 1 2 3 4 5 
        ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
       6 7 8 9 1 2 3 4 5 6 7 8 9 
       ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
      1 2 3 4 5 6 7 8 9 1 2 3 4 5 
      ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
     6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 
     ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
    3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 
    ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
   1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 
   ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
  9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 
  ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 
 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
```
*Edit: I had a play casting `int` to `ConsoleColor`... Tis the season :)*
[![enter image description here](https://i.stack.imgur.com/LJ6Wp.png)](https://i.stack.imgur.com/LJ6Wp.png)
*MerryChristmas.gif*
[![enter image description here](https://i.stack.imgur.com/yjJL5.gif)](https://i.stack.imgur.com/yjJL5.gif)
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~29~~ ~~27~~ 24 bytes
Saved three bytes thanks to Adnan!
```
>GN„^ ×NÝNLO<+²%>ðý}\».c
>G                       For N in [1, ..., input[0]]
  N„^ ×                  Push a string of "^ " N times
       NÝ                Push [0, ..., N]
         NLO<            Compute the decoration offset, sum([1, ..., N])-1
             +           Add the offset value to each array cell
              ²%         Modulo input[1]
                >        Add 1 so that it is in range [1, k] instead of [0, k-1]
                 ðý      Join with spaces, now we have a string with the full decoration for the current layer
                   }     End for
                    \    Remove the last decoration
                     »   Join everything with newlines
                      .c Center all and implicitly display
```
[Try it online!](http://05ab1e.tryitonline.net/#code=PkdO4oCeXiDDl07DnU5MTzwrwrIlPsOww719XMK7LmM&input=Ngo1)
[Answer]
## JavaScript (ES6), 97 bytes
It seems like your wife *really* is maniacal, so this doesn't include any leading or trailing newline, nor any leading or trailing space. :-)
```
f=(n,k,x,s=`^
`)=>n--?(p=' '.repeat(n)+s,x?p.replace(/\^/g,_=>x++%k+1)+p:p)+f(n,k,x||k,'^ '+s):''
```
### Demo
```
f=(n,k,x,s=`^
`)=>n--?(p=' '.repeat(n)+s,x?p.replace(/\^/g,_=>x++%k+1)+p:p)+f(n,k,x||k,'^ '+s):''
console.log(f(6, 5))
```
[Answer]
# C++ 214 - 13 - 3 - 1 -1 - 10 = 186 bytes
golfed
```
#define s std::cout<<
int f(int n,int k){int N=++n,K=0,i=0,I;for(;i<n;i++,N--){for(I=N;I--;)s' ';for(I=0;I++<i&&i-1;)s' '<<(K++%k)+1;s'\n';for(I=N;I--;)s' ';for(I=0;I++<i;)s" ^";s'\n';}}  
```
Thanks @ cyoce for saving 1 byte.  
Thanks @ conor for *chopping* it down to 186!
Ungolfed + copy&compile
```
#include<iostream>
#include<conio.h>
#define s(a) std::cout<<a;
int main()
{
    int n,N,k,K=0,i,I;
    std::cin>>n>>k;
    N=++n;
    for(i=0;i<n;i++,N--)
    {
        for(I=N;I--;)
        
            s(' ')
            
        for(I=0;I<i&&i-1;I++)
        
            s(' '<<(K++%k)+1)
            
        s('\n')
        
        for(I=N;I;I--)
        
            s(' ')
            
        for(I=0;I<i;I++)
        
            s(" ^")
            
        s('\n')
            
    }
    getch();//or any func to pause the console
}  
```
[Answer]
## Python 2, 133 bytes
```
n,k=input()
d=-1
j=' '.join
for i in range(1,n+1):s=' '*(n-i);print(['',s+j(`x%k+1`for x in range(d,d+i))+'\n'][i>1]+s+j('^'*i));d+=i
```
[Answer]
**Clojure, 223 bytes**
My first go at golfing with Clojure:
```
(let[r repeat](defn d[n k](apply str(concat(r(dec n)\ )"^\n"(flatten(for[i(range 2(inc n))m[nil true]](concat(r(- n i)\ )(butlast(interleave(if m(r\^)(rest(iterate #(inc(mod % k))(dec(/(* i(dec i))2)))))(r i\ )))"\n")))))))
```
When called like `(println (str "\n" (d 6 5)))` a newline makes it nicer on REPL:
```
     ^
    1 2
    ^ ^
   3 4 5
   ^ ^ ^
  1 2 3 4
  ^ ^ ^ ^
 5 1 2 3 4
 ^ ^ ^ ^ ^
5 1 2 3 4 5
^ ^ ^ ^ ^ ^
```
Un-golfed:
```
(defn tree-row [n k index mode]
  (concat
    (repeat (- n index) \ ) ; Left padding
    (butlast ; Removing trailing space
      (interleave
        ; Either printing carets or numbers...
        (if mode
          (repeat \^)
          ; Using "rest" as the iteration starts from a large value
          ; from which the modulo has not been calculated yet.
          (rest (iterate #(inc (mod % k)) (dec (/ (* index (dec index)) 2)))))
        ; ...and interleaved with spaces
        (repeat index \ )))
    "\n"))
(defn decorate [n k]
  (apply str (concat
               (repeat (dec n) \ ) "^\n"
               (flatten (for [index (range 2 (inc n)) mode [nil true]]
                          (tree-row n k index mode))))))
```
I had some issues with lazy sequences and nested lists but I was able to save some characters by not repeating `repeat` ;) and using `\^` characters instead of `"^"` strings. I could also leave out surprisingly many spaces.
[Answer]
## Ruby 107 bytes
```
t=->(n,k){d=[*1..k]*n*n;o=0;(1..n).each{|b|s=' '*(n-b);b>1&&(puts(s+d[o,b].join(' '));o+=b);puts s+'^ '*b}}
```
Called like this
```
t.call(5,4)
```
Output:
```
    ^
   1 2
   ^ ^
  3 4 1
  ^ ^ ^
 2 3 4 1
 ^ ^ ^ ^
2 3 4 1 2
^ ^ ^ ^ ^
```
[Answer]
# C, 170 bytes
```
i=0;d,j,l;t(n,k){char s[20],r[20];d=k-2;l=n;for(;i++<n;){for(j=0;j<l;++j)s[j]=r[j]=32;for(j=n-i;j<l;j+=2){s[j]=94;r[j]=(++d%k)+49;}s[l]=r[l++]=0;if(i-1)puts(r);puts(s);}}
```
Call with:
```
int main()
{
   t(5,4);
}
```
As a bonus, here's a 4-bit binary version:
```
m=0;b(n,k){char*a="000100100011010001010110011110001001";char s[20],r[20];d=k*4-2;l=n;for(;m++<n;){for(j=0;j<l;++j)s[j]=r[j]=32;for(j=n-m;j<l;j+=2){s[j]=94;r[j]=a[++d%(k*4)];}s[l]=r[l++]=0;if(m-1)puts(r);puts(s);}}
```
]