[Question]
  [
## Challenge:
Here we have the first 100 items of a sequence:
```
6,5,4,3,2,1,66,65,64,63,62,61,56,55,54,53,52,51,46,45,44,43,42,41,36,35,34,33,32,31,26,25,24,23,22,21,16,15,14,13,12,11,666,665,664,663,662,661,656,655,654,653,652,651,646,645,644,643,642,641,636,635,634,633,632,631,626,625,624,623,622,621,616,615,614,613,612,611,566,565,564,563,562,561,556,555,554,553,552,551,546,545,544,543,542,541,536,535,534,533,...
```
How is this sequence formed? We first have the number in the range `[6, 1]` (all possible values of a single die from highest to lowest). We then have the numbers `[66..61, 56..51, 46..41, 36..31, 26..21, 16..11]` (all possible concatted values of two dice from highest to lowest). Etc.  
This is related to the OEIS sequence [A057436: *Contains digits 1 through 6 only*](http://oeis.org/A057436), but with all the numbers with equal amount of digits sorted backwards in the sequence.
The challenge is to choose one of these three options for your function/program with the sequence above:
1. Take an input \$n\$ and output the \$n\$'th value of this sequence, where it can be either 0-indexed or 1-indexed.
2. Take an input \$n\$ and output the first \$n\$ or \$n+1\$ values of this sequence.
3. Output the values from the sequence indefinitely.
Of course, any reasonable output format can be used. Could be as strings/integers/decimals/etc.; could be as an (infinite) list/array/stream/etc.; could be output with space/comma/newline/other delimiter to STDOUT; etc. etc. **Please state what I/O and option you're using in your answer!**
## General rules:
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer in bytes wins.  
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
* [Standard rules apply](https://codegolf.meta.stackexchange.com/questions/2419/default-for-code-golf-program-function-or-snippet/2422#2422) for your answer with [default I/O rules](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/), so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
* [Default Loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are forbidden.
* If possible, please add a link with a test for your code (i.e. [TIO](https://tio.run/#)).
* Also, adding an explanation for your answer is highly recommended.
**Here some larger test cases if you choose option 1:**
```
n         0-indexed output    1-indexed output
500       5624                5625
750       4526                4531
1000      3432                3433
9329      11111               11112
9330      666666              11111
9331      666665              666666
10000     663632              663633
100000    6131232             6131233
```
  
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~24~~ 23 bytes
*-1 byte thanks to nwellnhof*
```
{.put;.[]X~(6...1)}...*
```
[Try it online!](https://tio.run/##K0gtyjH7/79ar6C0xFovOjaiTsNMT0/PULMWSGr9/w8A "Perl 6 – Try It Online")
Outputs the sequence infinitely separated by spaces/newlines. Or, for a few more bytes we can have a lazy infinite list we can index into instead.
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 27 bytes
```
{flat {@=.[]X~(6...1)}...*}
```
[Try it online!](https://tio.run/##Zc7fCoIwFAbw6/YU56o0YuzsuIWE0mMEskBIIbA/aBAi9uo2nUGt72Kwj992zr2oKz1cWliWkMDQlVX@gG6f8MwcXoHmnGPY23PdD03eQhmE2RGFMDvGylsN1flaNGnKn7f61EDHFh/EM2HMBlaQpLDaAM/QsH5QQoCL0jICL7ZTbKs@JFJS@yRShMzOnw1FJH1iO2IxydhdcYxHxkpaQ/M3esq/wdHgl1G/xr2b9hFzQdrfaOrIoUlpJJSech29AQ "Perl 6 – Try It Online")
### Explanation:
```
{                         }    # Anonymous code block
 flat                          # Return the flattened
                      ...*       # Infinite sequence
      {              }             # Defined as
         .[]                       # The previous element arrayified
            X~                     # Each concatenated with
              (6...1)              # All of 6 to 1
       @=                          # Arrayified
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~39~~ ~~38~~ 34 bytes
```
f=lambda n:n and-n%6+1+f(~-n/6)*10
```
[Try it online!](https://tio.run/##Vc3RCsIwDAXQ935FQYTVbdg0a2UDP6ai1YJmY@zFF3@9dh2b9UIg5BDu8J4ePakQ3PlpX5er5dQRt3StaW9KKF3xqeloxAFkcP3IPffER0v3WwGVkaJjfBg9TdwVXlQs7YytJy2l4DG7ONoovcFJ/6DRCBuAXF5mwAZxgxZVuwLEqExQ5gK5wCom5a9n/loITdaUKFoiQFCI4Qs "Python 2 – Try It Online")
Outputs 1-indexed number
[Answer]
# [R](https://www.r-project.org/), 43 bytes
```
p='';repeat cat(p<-sapply(p,paste0,6:1),'')
```
[Try it online!](https://tio.run/##K/r/v8BWXd26KLUgNbFEITmxRKPARrc4saAgp1KjQKcgsbgk1UDHzMpQU0ddXfP/fwA "R – Try It Online")
Prints the sequence indefinitely
* -9 thanks to @Kirill L.
[Answer]
# Bash, 31 bytes
```
f()(x+={6..1};eval echo $x;f);f
```
[TIO](https://tio.run/##S0oszvj/P01DU6NC27baTE/PsNY6tSwxRyE1OSNfQaXCOk3TOu3/fwA)
update from comments, the n'th value 1-indexed, +GNU tools + perl, 64 bytes, 7 bytes saved thanks to @manatwork
```
dc<<<6o$1p|perl -pe 's/(.)0/($1-1).6/e?redo:s/0//'|tr 1-6 654321
```
[64 bytes](https://tio.run/##Zc7BCoJAEAbgu08xB0E76O7suBOV0INIRLULBaKiQRff3VbXoLb/Nj/fDHO9DPfpdX/UFnp7MdDAeRyrCuIGTqeDaWGwTzdM5laWJbcxdmNn@xqyzkIyiDTfSJHGmOEmZ2GPvTXtfhBSiGR89oAZA@uCFE6mbeykpQQfzaqAIK7T0VZ/SKEVh6TQhBHKzxlyp0PiOop2pHZ@xDkBmSvlDK1neMm/wdngl9G/xu8t/8i1IA4/WjryaFGMhCpQvqM3)
[Answer]
# [MATL](https://github.com/lmendo/MATL), 11 bytes
```
`6:P!V@Z^DT
```
Outputs the values indefinitely.
[Try it online!](https://tio.run/##y00syfn/P8HMKkAxzCEqziXk/38A "MATL – Try It Online")
### Explanation
```
`      % Do...while
  6:   %   Push [1 2 3 4 5 6]
  P    %   Flip: gives [6 5 4 3 2 1]
  !    %   Transpose: turns the row vector into a column vector
  V    %   Convert the number in each row to the corresponding char
  @    %   Push current iteration index, starting from 1
  Z^   %   Cartesian power. Gives a matrix where each row is a Cartesian tuple
  D    %   Display immediately
  T    %   Push true. This is used as loop condition, to give an infinite loop
       % End (implicit)
```
[Answer]
# Haskell, ~~38~~ 34 bytes
An infinite list of numbers:
```
d=[6,5..1]
l=d++[10*m+n|m<-l,n<-d]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P8U22kzHVE/PMJYrxzZFWzva0EArVzuvJtdGN0cnz0Y3JfZ/bmJmnoKtQkFRZl6JgopCSWJ2qoKhgYFCzn8A "Haskell – Try It Online")
Two earlier solutions that give infinite lists of strings, each using 38 bytes:
```
[1..]>>=sequence.(`replicate`"654321")
```
[Try it online!](https://tio.run/##DcxLDkAwEADQq0zEgoVG/XZ1ESQmzaBRTbV1fcM7wDswnmQtB4pq5kkKsYyjinQ/5DSJYg3krdGYaM2GvmsbmZV8oXGgwAfjEuSQ8CSQdQ1/wq/eLO6RK@39Bw "Haskell – Try It Online")
```
do n<-[1..];mapM id$[1..n]>>["654321"]
```
[Try it online!](https://tio.run/##FcxNEkAgFADgq7wxtkz526AbOEFavCE0JU05v4flt/kOTFY7R1Gncab1Aj8Ukpel6k8ME5g1/@WVEDLr2qaueKboRONhhBCNvyGHG60Gzhh8CT3L5nBPVCwhvA "Haskell – Try It Online")
[Answer]
# JavaScript (ES6), 26 bytes
Returns the \$n\$th term, 1-indexed.
```
f=n=>n--&&[f(n/6|0)]+6-n%6
```
[Try it online!](https://tio.run/##bc5NDsIgEAXgvadgYwMxyAxTMF3UixgXTS1G00BjjSvvjlqtP8W3/d7LzLG6VH19OnRn6cOuidGVvlx7KbNs47hX9gpiu7DSz22sg@9D2yzbsOeOGwDGmBBMKWasNrNfXpkP54ZwwgiP@ZMpJ5pwQboYGe/RiRN8O6aOo9shf@7Du0A2@WAowKuAhJoo3gA "JavaScript (Node.js) – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 28 bytes
```
l=(+).(10*)<$>0:l<*>[6,5..1]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P8dWQ1tTT8PQQEvTRsXOwCrHRssu2kzHVE/PMPZ/bmJmnoKtQkFRZl6JgopCSWJ2qoKhgYFCzn8A "Haskell – Try It Online")
Produces an infinite list of numbers `l`. Using `<$>` and `<*>` cuts a byte off:
**29 bytes**
```
l=[10*n+d|n<-0:l,d<-[6,5..1]]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P8c22tBAK087pSbPRtfAKkcnxUY32kzHVE/PMDb2f25iZp6CrUJBUWZeiYKKQklidqqCoYGBQs5/AA "Haskell – Try It Online")
The approach is similar to the Haskell [Output All String answer](https://codegolf.stackexchange.com/a/74293/20260) fixed input string "654321", and skipping the empty string output by changing where it's prepended.
**30 bytes**
```
l=[n++[d]|n<-"":l,d<-"654321"]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P8c2Ok9bOzoltibPRldJySpHJwVIm5maGBsZKsX@z03MzFOwVSgoyswrUVBRKEnMTlUwNDBQyPkPAA "Haskell – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 10 bytes
Outputs the sequence indefinitely.
```
¸[6LRâJD»,
```
[Try it online!](https://tio.run/##yy9OTMpM/f//0I5oM5@gw4u8XA7t1vn/HwA "05AB1E – Try It Online")
**Explanation**
```
¸           # initialize the stack with a list containing the empty string
 [          # loop
  6L        # push [1 ... 6]
    R       # reverse
     â      # cartesian product
      J     # join each inner list
       D    # duplicate (saving a copy for next iteration)
        »,  # join on newline and print
```
[Answer]
# Perl 5, ~~40~~ 37 bytes
-3bytes thanks to @Xcali
```
map{say}<"$_">while s//{6,5,4,3,2,1}/
```
[37 bytes](https://tio.run/##K0gtyjH9/z83saC6OLGy1kZJJV7JrjwjMydVoVhfv9pMx1THRMdYx0jHsFb///9/@QUlmfl5xf91fU31DAwB)
[40 bytes](https://tio.run/##K0gtyjH9/z@1LDFHqTixUiEtv8hGJd5OqTwjMydVoVhfv9pMx1THRMdYx0jHsFb///9/@QUlmfl5xf91fU31DAwB)
[Answer]
# [Java (JDK)](http://jdk.java.net/), 48 bytes
```
String f(int n){return n-->0?f(n/6)+(6-n%6):"";}
```
[Try it online!](https://tio.run/##ZY5NboMwEIX3nOIJqRJuDDWhoQqo7Qm6yrLqghCITMEge4hUIc5ObUhXleyZNz/63jTFrQiby/ciu6HXhMbW0UiyjR5z71@vHlVJslduWLaFMfgopMLkAYYKkuVyIi3VFXUgFUGxSVc0agUVhm/ivQ7UU8p2QRqqh5Rlvp/PCzCM51aWdwBuvbygs9RgQ31@odBXw1YTwGJthypDBq@YEHPsORKOZ44DR8rxYoUQNh9siIWTx2R/dDFZdRJv/ftYCMz5yq57vZ7t6Nnm8WcLnH4MVV3UjxQN9i5qVeA2sIOfwbepXmvGNtbsue/Zt/wC "Java (JDK) – Try It Online")
This returns the 1-indexed nth element.
Recursion seems to beat the iterative lambda.
---
### Iterative version, 49 bytes
```
n->{var r="";for(;n-->0;n/=6)r=6-n%6+r;return r;}
```
[Try it online!](https://tio.run/##ZY8xb4MwEIV3fsUTUiVoDCWhoUpcGCt16JSx6uASQKZgkH1EiiJ@OzWQTh1873zv9N1dLS4iqM8/k2z7ThNq@w8Hkk34yJ1/tXJQOclOzWbeCGPwIaTCzQH64buROQwJsnLp5Bmt9bwTaamqzy8IXRl/aQXe7pzXd0VFVWi2dmUokWJSQXa7CA2dui4vO@1xFQRZxNVTmvg6TQL1kGw01wUNWkHzceILVSqyc6gwZCzmhi3DjiFmeGbYMyQMLzaJIqt7G7bRnB7i3WGO8ZLH27V@t6MI48qe17D8hX5cZ/wdA5yuhoo27AYKe3sHNcqbO7CBe4RrpQxF3zfXper7K3F05jdOvw "Java (JDK) – Try It Online")
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~13~~ 11 bytes
*Thanks to [Fatalize](https://codegolf.stackexchange.com/users/41723/fatalize) for 2 bytes*
```
6~d{⟧₁∋}ᵐẉ⊥
```
Outputs indefinitely. [Try it online!](https://tio.run/##ASUA2v9icmFjaHlsb2cy//82fmR74p@n4oKB4oiLfeG1kOG6ieKKpf// "Brachylog – Try It Online")
Here's a 14-byte version that outputs the first \$n\$ values: [Try it online!](https://tio.run/##ASwA0/9icmFjaHlsb2cy//87Nnt@ZHvin6figoHiiIt94bWQfeG2oOKBvf//NDj/WA)
### Explanation
```
6~d           Start with a number, all of whose digits are 6's
              Brachylog considers these in the order 6, 66, 666, 6666...
   {   }ᵐ     Map this predicate to each of those digits:
    ⟧₁         1-based reverse range: [6,5,4,3,2,1]
      ∋        The output digit must be a number in that range
              Brachylog considers possible outputs in this order: 6, 5, 4, 3, 2, 1, 66, 65...
         ẉ    Write a possible output with newline
          ⊥   Force the predicate to fail and backtrack to the next possibility
```
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 38 bytes
```
int f(int n)=>n-->0?f(n/6)*10+6-n%6:0;
```
[Try it online!](https://tio.run/##JY5PC4JAFMTvfopHELj5p2eioZIduhYEHTpEB9lWemBPcJcixM9uq11@DDPDMFIHsu3UKJtKazhD72hTGZLwbukBp4rYFdCPxAZqdyKLXclBUOK@dnmdilWEXhrwMs2xGGs7VcknzE0CYmD1ud37BNHfJuhHaEUWbzKLeFJxNHv/BHEQDsDlq416hYeWdduo8NqRUUdi5RJ4sMgXlvaKEIUzOMP4Aw "C# (.NET Core) – Try It Online")
Outputs the n-th value (1-based).
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
ḃ6ạ7V
```
[Try it online!](https://tio.run/##y0rNyan8///hjmazh7sWmof9P7T5cPujpjX/AQ "Jelly – Try It Online")
1-indexed nth value.
[Answer]
# Japt, 14 bytes
There's gotta be a shorter solution using function methods and/or Cartesian product but (for now?) the best I can manage is a port of Arnauld's JS solution so be sure to upvote him too.
```
©ß´Uz6)s+6-Uu6
```
[Try it](https://ethproductions.github.io/japt/?v=2.0a0&code=qd+0VXo2KXMrNi1VdTY=&input=NTAw) or [test terms `0-1000`](https://ethproductions.github.io/japt/?v=2.0a0&code=qd+0VXo2KXMrNi1VdTY=&input=MTAwMQotbQo=)
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~88~~ 78 bytes
```
(l=d=c=7-Range@6;While[Length@c<#,d=Flatten[(10#+l)&/@d];c=c~Join~d;];c[[#]])&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78/18jxzbFNtnWXDcoMS891cHMOjwjMyc12ic1L70kwyHZRlknxdYtJ7GkJDUvWsPQQFk7R1NN3yEl1jrZNrnOKz8zry7FGsiJjlaOjdVU@58WnRcfa2VLXVOj82K5Aooy80oc0qJNDQwQHHNTJI6hAbKUpbGRJTLPGEXO2BBVH5oxQP5/AA "Wolfram Language (Mathematica) – Try It Online")
saved 4 + 6 bytes thanks to @IanMiller
List is 1 indexed, outputs the n'th number.
[Answer]
# Mathematica, 56 bytes
```
Flatten[FromDigits/@Tuples[7-Range@6,#]&/@Range@#][[#]]&
```
Requires excessive amounts of memory to actually run as it creates all numbers in the sequence which have length equal to or less than the input (i.e. it creates \$\frac{6}{5}(6^n-1)\$ terms) then takes the required value from the list. For practice use replace the second last # with a specific value for the length you want to use it on.
[Answer]
# [Pip](https://github.com/dloscutoff/pip) `-l`, 16 bytes
```
x:YP6-,6W1PxCP:y
```
Outputs the sequence indefinitely. [Try it online!](https://tio.run/##K8gs@P@/wioywExXxyzcMKDCOcCq8v///7o5AA "Pip – Try It Online")
### Explanation
The `-l` flag means that lists are printed with each item on its own line; if an item is itself a list, its elements are concatenated with no separator. E.g. the list `[1 [2 3] [4 [5 6]]]` would be printed as
```
1
23
456
```
With that cleared up:
```
x:YP6-,6W1PxCP:y
      ,6          Range(6): [0 1 2 3 4 5]
    6-            Subtract each element from 6: [6 5 4 3 2 1]
  YP              Yank that value into the y variable, and also print it
x:                Assign that value also to x
        W1        While 1 (infinite loop):
           xCP:    Assign to x the cartesian product of x with
               y   the list [6 5 4 3 2 1]
          P        Print it
```
After the first loop iteration, `x` looks like `[[6;6];[6;5];[6;4];...;[1;1]]`; after the second iteration, `[[[6;6];6];[[6;6];5];[[6;6];4];...;[[1;1];1]]`; and so on. We don't need to worry about flattening the sublists, because `-l` effectively does it for us.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 18 bytes
```
ＮθＷθ«←Ｉ⊕﹪±θ⁶≔÷⊖θ⁶θ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/98zr6C0xK80Nym1SKNQ05qrPCMzJ1UByFSo5uIMKMrMK9Gw8klNK9FRcE4sLtHwzEsuSs1NzStJTdHwzU8pzcnX8EtNTyxJBerQUTDTBAJrLk7H4uLM9Dyg4hKXzLLMlFQNl1SENohCHQWQbbX//5ubGvzXLcsBAA "Charcoal – Try It Online") Link is to verbose version of code. 1-indexed. Explanation:
```
Ｎθ
```
Input `n`
```
Ｗθ«
```
Repeat until `n` is zero.
```
←Ｉ⊕﹪±θ⁶
```
Reduce `-n` modulo `6`, then increment the result and output from right to left.
```
≔÷⊖θ⁶θ
```
Decrement `n` and integer divide it by `6`.
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 36 bytes
```
.+
$*_
+`(_*)\1{5}(_+)
$1$.2
T`7-1`d
```
[Try it online!](https://tio.run/##K0otycxL/K@q4Z7wX0@bS0Urnks7QSNeSzPGsNq0ViNeW5NLxVBFz4grJMFc1zAh5f9/UwMDLnNTAy5DAyDD0tjIEkgYg1jGhmAxiIyBAQA "Retina 0.8.2 – Try It Online") Link includes test cases. 1-indexed. Explanation:
```
.+
$*_
```
Convert to unary. (Retina 1 would save 2 bytes here.)
```
+`(_*)\1{5}(_+)
$1$.2
```
Convert to bijective base 6 by repeated divmod. Note that the use of `+` means that the extracted digit is always a number from 1 to 6 instead of 0 to 5 for regular base 6 conversion. (`(_{6})*` is faster but costs bytes extracting the quotient.)
```
T`7-1`d
```
Transpose the digits so that the 6s come first and the 1s last. (There are no 7s or 0s but this allows me to use the `d` shortcut.
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 22 bytes
This will output the sequence indefinitely. The general idea is that it has a base number which 6 - 1 is added to. For each add the result is output multiplied by 10, which is pushed to the bottom of the stack to be used later in the sequence. The base is then popped and the next base started.
```
..w.06+ONo*w;|uW!(pq;;
```
[Try it online!](https://tio.run/##Sy5Nyqz4/19Pr1zPwEzb3y9fq9y6pjRcUaOg0Nr6/38A "Cubix – Try It Online")
```
    . .
    w .
0 6 + O N o * w
; | u W ! ( p q
    ; ;
    . .
```
[Watch It Run](https://ethproductions.github.io/cubix/?code=ICAgIC4gLgogICAgdyAuCjAgNiArIE8gTiBvICogdwo7IHwgdSBXICEgKCBwIHEKICAgIDsgOwogICAgLiAuCg==&input=&speed=20)
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), infinite printing, ~~181 180~~ 88 bytes.
```
string[] s=new string[]{" "},t;int i,j,k,l=1;while(true){j=l;t=new string[l=6*j];for(i=6;i>0;i--)for(k=(6-i)*j;k<l;)t[k]=i+s[k++%j];
for(k=0;k<l;)System.Console.Write(t[k++]);s=t;}
```
Sadly it freezes repl.it instead of outputting properly in the infinite version as written (I believe it to be an error in repl.it, as it does not output as the program loops like it should), so anyone hoping to test needs a computer. If you add a read at the front of the loop it works in repl.it as well.
Outputs to the console, obviously.
On any finite system the code will most likely eventually crash with an out of memory error.
Reworked the code to use @dana 's lambda.
```
int f(int n)=>n-->0?f(n/6)*10+6-n%6:0;for(int i=0;++i>0;)System.Console.Write(f(i)+" ");
```
[Try it online!](https://tio.run/##Hcy9CsIwFEDh3ae4FITEkBqXDobGwVkQHBzEIcS0XKg3kBsEKX32@LOc6eME1iHlWMPkmeEM84qLLxjglfABJ48kuGSk8XYHL2GuSAUG8SvJ3pHWzhwGQdtObnZGdZrW3d7YIeW/wd5YpdAZKy9vLvHZHhNxmmJ7zVii@J6kaqCRti5L/QA "C# (.NET Core) – Try It Online")
[Answer]
# [Forth (gforth)](http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/), 63 bytes
```
: f recursive dup 6 < if 6 - abs 1 .r else 6 /mod 1- f f then ;
```
[Try it online!](https://tio.run/##NYtNDoIwEIX3PcUL@2JrgwYh3kVhRkhUmil4/ToozOZ7P/N4knmwD16R8wUMoW6RNH4I/RJxQouRFRa3e4JHKaBnIk0Or6mHtzphzAO90eg@bit9KwvAXlFo3QkaYyrnsF4052pX3mkYTR2O9Q/h74LfOrdTRf4C "Forth (gforth) – Try It Online")
0-indexed outputs nth value
### Explanation
If N is less than 6, output the absolute value of N - 6. Otherwise, get the quotient and remainder of dividing N by 6. Call the function recursively on the quotient, then call it on the remainder.
### Code Explanation
```
: f                 \ start a new word definition
  recursive         \ declare that this word is recursive so we can call it from itself
  dup 6 <           \ check if n is less than 6
  if                \ if it is:
    6 - abs 1 .r    \ subtract 6, get the absolute value, then print with no appended space
  else              \ else if it's greater than 6:
    6 /mod          \ get the quotient and remainder of dividing n by 6
    1-              \ subtract 1 from the quotient (because we're 0-indexed)
    f               \ call f on the result
    f               \ call f on the remainder (shortcut to format and print, it's always < 6)
  then              \ end the if/else
;                   \ end the word definition
```
[Answer]
# APL(NARS), 27 chars, 54 bytes
```
{0>⍵-←1:0⋄(6-6∣⍵)+10×∇⌊⍵÷6}
```
traslate the solution by dana <https://codegolf.stackexchange.com/a/179980> in APL...
test:
```
  f←{0>⍵-←1:0⋄(6-6∣⍵)+10×∇⌊⍵÷6}
  f 500
5625
  f¨750 1000 9329 9331 10000 100000
4531 3433 11112 666666 663633 6131233 
  f¨⍳9
6 5 4 3 2 1 66 65 64 
```
[Answer]
# C#, print from start to n, ??? bytes
Credit to @dana for the lambda expression.
```
int f(int n)=>n-->0?f(n/6)*10+6-n%6:0;for(int i=0;i<int.Parse(a[0]);)System.Console.Write(f(++i)+" ");
```
Operation: Run with command line 0th argument equal to the integer you want to count to. (It should be noted that `a[0]` is a reference to the otherwise unmentioned command line args array, and I don't know how to count it.)
]