[Question]
  [
Given an input integer `n >= 10`, output the average of all deduplicated rotations of the integer.
For example, for input `123`, the rotations are `123` (no rotation), `231` (one rotation) and `312` (two rotations). The average of those is `(123 + 231 + 312) / 3` or `222`.
As another example, take `4928`. The rotations are `4928`, `9284`, `2849`, and `8492`. Taking the average of those four numbers equals `6388.25`.
For another example, for input `445445`, the deduplicated rotations are `445445`, `454454`, and `544544`, so the output is `481481`.
For input `777`, there is only one deduplicated rotation, so the output is `777`.
## Rules
* If applicable, you can assume that the input/output will fit in your language's native Integer type.
* The input and output can be given by [any convenient method](http://meta.codegolf.stackexchange.com/q/2447/42963).
* Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
* [Standard loopholes](http://meta.codegolf.stackexchange.com/q/1061/42963) are forbidden.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so all usual golfing rules apply, and the shortest code (in bytes) wins.
  
[Answer]
# [Python 3](https://docs.python.org/3/), ~~38~~ 36 bytes
```
lambda*n:10**len(n)//9*sum(n)/len(n)
```
Takes the digits as separate arguments. *Thanks to @Rod for suggesting Python 3, saving 2 bytes.*
[Try it online!](https://tio.run/##K6gsycjPM/6fpmCrEPM/JzE3KSVRK8/K0EBLKyc1TyNPU1/fUqu4NBfEggj8T8svUshTyMxTMDQy1lEwsTSyAJImpkCko2Bubm7FxVlQlJlXopGmXp1nZVaroGunUJ2moZWbWKABFNZRKC4pAhqjqWllUauu@R8A "Python 3 – Try It Online")
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 9 bytes
```
10⊥≢⍴+/÷≢
```
A monadic function taking a vector of digits as an argument.
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R2wRDg0ddSx91LnrUu0Vb//B2IOv//3SgeHWaAkSqd/Gh9YaPuoAKttYqPOqdq@Ccn1eWWlRSrFCSr5CokJNZXKKQn6aQkpmeCRRLyywC8tPyixRSE4tTQRKlxalc6QqGRsZA0sTSyAJEmZgCEZBhbm4OAA "APL (Dyalog) – Try It Online")
I take the average of the digits `+/÷≢`, then repeat it by the length of the input `≢⍴`, and finally convert from base 10.
Conceptially, I am taking the sum of the rotations (without carrying):
```
 4  2  9  8
 2  9  8  4
 9  8  4  2
+8  4  2  9
 -----------
 23 23 23 23
```
This is just `4+2+9+8` repeated 4 times. Then converting from base `10` (which does the carrying for me)
 and dividing by the length. Although I divide by the length earlier on because it is equivilent and saves bytes.
[Answer]
# Java 10, ~~163~~ ~~137~~ ~~76~~ ~~72~~ 71 bytes
```
n->(Math.pow(10,n.size())-1)/9*n.stream().mapToInt(i->i).sum()/n.size()
```
-36 bytes thanks to *@Nevay*.  
-61 bytes thanks to *@OlivierGrégoire* by creating a port of [*@Dennis*' Python 3 answer](https://codegolf.stackexchange.com/a/162438/52210).  
-1 bytes by taking the input as a List of digits instead of String.
**Explanation:**
[Try it online.](https://tio.run/##tY9NT8MwDIbv@xU@JijNKAzBVKjEEYntMm6Ig2mzLaVNqsTdNFB/ezH7uCCOIx@W7Lx@8rrCDSZV@TEUNcYIM7TuawRgHZmwxMLA/CcFKH33XhsoRMUNuiNb68cQcPdsI90/sXplQg5OZqzu@fKJhGQLmIODBxhckosZ0lq3fivSS@V0tJ9GSJmkcjy94JSCwUZI3WD74hkpbJJbqWPHxfFJPmQHeMt2GH78Y@NtCQ17FwsK1q1e31AefC92kUyjfUe65ReqnXC6EM5s4Y9Jfk8XNcZ9PVVX6lryys5Jnagpc@/@gTtRN2ofz86@VbxP1H7UD98)
```
n->                                 // Method with String parameter and double return-type
  (Math.pow(10,n.size())-1)/9       //  Repunits the same length as the input-size
  *n.stream().mapToInt(i->i).sum()  //  multiplied by the sum of digits
  /n.size()                         //  divided by the input-size
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 5 bytes
```
d´MKA
```
[Try it online!](https://tio.run/##yygtzv6fm/@oqTHlf8qhLb7ejv///482NDLWMbE0stAxNTEBIh1zc/NYAA "Husk – Try It Online")
### Explanation
```
d´MKA
    A  Take the average of the digits
 ´MK   Replace each element of the original list with the average
d      Join the list to get a number
```
---
# [Husk](https://github.com/barbuz/Husk), 7 bytes
```
A§modṙŀ
```
[Try it online!](https://tio.run/##yygtzv6fm/@oqTHlv@Oh5bn5KQ93zjza8P///2hDI2MdE0sjCx1TExMg0jE3N48FAA "Husk – Try It Online")
### Explanation
```
A§modṙŀ
      ŀ  Take the range [1..length(input)]
 §m  ṙ   Rotate the input by each element of the range
   od    Convert each list of digits to a number
A        Take the average of the list
```
[Answer]
# [R](https://www.r-project.org/), ~~84~~ ~~73~~ 64 bytes
```
function(D,K=sum(D|1))mean(array(D,K+1:0)[1:K,1:K]%*%10^(K:1-1))
```
[Try it online!](https://tio.run/##K/qfpmCj@z@tNC@5JDM/T8NFx9u2uDRXw6XGUFMzNzUxTyOxqCixEiSubWhloBltaOWtA8SxqlqqhgZxGt5WhrpAlf/TNJI1zHWAUFOTC8Q20bHUMdKxAMoAAA "R – Try It Online")
Input as list of digits.
Thanks to MickyT for shaving off 11 bytes! 8 bytes shaved by Dennis' proof that deduplication is unnecessary.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 3 bytes
```
Ṗ⌊ṁ
```
*-2 bytes thanks to @lyxal*
[Try it online!](https://vyxal.pythonanywhere.com/#WyLhuaAiLCIiLCLhuZbijIrhuYEiLCIiLCIxMjMiXQ==)
Explanation
```
Ṗ   # Permutations
 ⌊  # Convert each to an integer
  ṁ # Mean
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes
```
vÀD}\OIg/
```
[Try it online!](https://tio.run/##MzBNTDJM/f@/7HCDS22Mv2e6/v//JiamQAQA "05AB1E – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 6 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
ñJä⌠╤►
```
[Run and debug it](https://staxlang.xyz/#p=a44a84f4d110&i=%22123%22%0A%224928%22%0A%22445445%22%0A%22777%22&a=1&m=2)
This program takes a quote-delimited string as input, and expresses the average as a reduced fraction. e.g. `777/1` It's not necessary to de-duplicate the rotations. It never changes the result.
Unpacked, ungolfed, and commented, it looks like this.
```
:)  get all character rotations
{em convert strings back to integers
:V  mean - integer inputs means result will be rational
```
[Run this one](https://staxlang.xyz/#c=%3A%29%09get+all+character+rotations%0A%7Bem%09convert+strings+back+to+integers%0A%3AV%09mean+-+integer+inputs+means+result+will+be+rational&i=%22123%22%0A%224928%22%0A%22445445%22%0A%22777%22&a=1&m=2)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~6~~ 5 bytes
```
ṙJḌÆm
```
[Try it online!](https://tio.run/##y0rNyan8///hzpleD3f0HG7L/X90j8vhdpVHTWvc//83NDLWUTCxNLIAkiamQKSjYG5uDgA "Jelly – Try It Online")
### How it works
```
ṙJḌÆm  Main link. Argument: A (digit array)
 J     Yield the indices of A, i.e., [1, ..., len(A)].
ṙ      Rotate A 1, ..., and len(A) units to the left, yielding a 2D array.
  Ḍ    Convert each rotation from decimal to integer.
   Æm  Take the arithmetic mean.
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 15 bytes
```
{.sum/$_*1 x$_}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoFZk@79ar7g0V18lXstQoUIlvva/NVdxIkhGQ8nQyFhJLzk/N0nPJ7O4RPM/AA "Perl 6 – Try It Online")
The average is the digit average applied to each decimal position, so digit average times 111.... `1 x $_` produces a string of 1s which get coerced to strings by the multiply.
Takes a list of digits as input. A sequence would require a .cache before the sum, and a number or string input would need a .comb.
[Answer]
# [Perl 5](https://www.perl.org/) `-lpF`, ~~24~~ 22 bytes
```
#!/usr/bin/perl -lpF
$_=1x@F/s/./+$&/g*eval
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3tawwsFNv1hfT19bRU0/XSu1LDHn/39DI2MuE0sjCy4TE1Mg4jI3N@f6l19QkpmfV/xfN6fA7b@ur6meoYGeAQA "Perl 5 – Try It Online")
Doing it as a list of digits is only 1 byte shorter and feels like cheating:
```
#!/usr/bin/perl -p
$;+=$_}{$_=1x$./$.*$
```
[Try it online!](https://tio.run/##K0gtyjH9/1/FWttWJb62WiXe1rBCRU9fRU9L5f9/Ey4TLlMuMPkvv6AkMz@v@L9uwX9dX1M9QwM9AwA "Perl 5 – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 60 bytes
```
->n{a=b=c=0.0;a,b,c,n=a+n%10,b*10+1,c+1,n/10while n>0;a*b/c}
```
[Try it online!](https://tio.run/##DcpBCsIwEEDRq2Tjph3bmRpJRaYXCVlkgkVBhyKIkbZnj4H/dv/9kV@ZuRwnXSMLJ8YOrxEEEijHVg@EIA1hS5Aq7Qm/98fzZnSqXyN92oun4QT2Moxg7bkGzrnQveKybnlbjM9gZp9D2Msf "Ruby – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 22 bytes
```
FromDigits[0#+Mean@#]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n6Zgq/DfrSg/1yUzPbOkONpAWds3NTHPQTlW7X9AUWZeSbSyjoKSgq6dgpKOQlq0cmysgpqCvoNCdbWhjpGOca2OQrWJjiWQaQFhmuiY6oBJENdcBwhra/8DAA "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 33 bytes
```
->n{10**(k=n.size)/9*n.sum*1.0/k}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6v2tBAS0sj2zZPrzizKlVT31ILyCrN1TLUM9DPrv1foJAWHW2oY6RjHBvLBeaY6FgCuRYIromOqQ6YhAmZ6wBhbOx/AA "Ruby – Try It Online")
A port of [Dennis's Python 3 answer](https://codegolf.stackexchange.com/a/162438/77598)
### Here's my lame attempt (74 bytes)
```
->s{a=(1..s.size).map{|i|s.chars.rotate(i).join.to_i}|[];a.sum*1.0/a.size}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1664OtFWw1BPr1ivOLMqVVMvN7GguiazplgvOSOxqFivKL8ksSRVI1NTLys/M0@vJD8@s7YmOtY6Ua@4NFfLUM9APxGssfZ/gUJatJKhkbFSLBeYaWJpZAFnm5gCEYxnbm6uFPsfAA)
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 43 bytes
```
x=>eval(x.join`+`)*'1'.repeat(n=x.length)/n
```
[Try it online!](https://tio.run/##BcFRCoAgDADQ46hFi6KPQuwiESi1SpEtSsLb23vBfe7dHn@nhnjHcpiSzYyfi3IBgLxCYE@2tqoSnYAHb3RJkskQkc50qZaK3phejgiRT3lIMUz9KJTS5Qc "JavaScript (Node.js) – Try It Online")
> 
> Can we take input as a list of digits? – Dennis♦ 7 mins ago
> 
> 
> @Dennis Sure, that's fine. Go save some bytes. :p – AdmBorkBork 3 mins ago
> 
> 
> 
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 8 bytes
Takes input as an array of single digit strings.
```
xpUÊ)÷UÊ
```
[Try it](https://ethproductions.github.io/japt/?v=2.0a0&code=eHBVyin3Vco=&input=WyI0IiwiNCIsIjUiLCI0IiwiNCIsIjUiXQ==)
---
## Explanation
```
             :Implicit input of array U
 pUÊ         :Repeat each string length of U times
x   )        :Reduce by addition
     ÷UÊ     :Divide by the length of U
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~21~~ 14 bytes[SBCS](http://github.com/abrudz/sbcs)
```
+/≢÷⍨⍳∘≢(⍎⌽)¨⊂
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R2wRt/Uediw5vf9S74lHv5kcdM4A8jUe9fY969moeWvGoqwmo6tAKdUMjY3UFdRNLIwsQZWIKRECGubm5OgA "APL (Dyalog Unicode) – Try It Online")
Tacit prefix function. Takes input as a string.
Thanks to Adám for [an enlightening 7 byte save](https://chat.stackexchange.com/transcript/message/44041397#44041397).
### How?
```
+/≢÷⍨⍳∘≢(⍎⌽)¨⊂ ⍝ Main fn, example argument '123'
              ⊂ ⍝ Enclose the argument (turns it into a scalar)
             ¨  ⍝ Use each of the left arguments to
         ( ⌽)   ⍝ Rotate, then
          ⍎     ⍝ Convert strings into numbers
      ⍳∘≢       ⍝ Tally (≢) the argument, then index (⍳) from 1. 
                ⍝ Returns 1 2 3 for a 3 digit argument, and rotates the argument 1, 2, then 3 times.
     ⍨          ⍝ Use the result as left argument for
    ÷           ⍝ Divide
   ≢            ⍝ By the number of rotations
+/              ⍝ And sum the results
```
[Answer]
# Python 2, ~~83~~ 77 bytes
```
def f(a):b={int(`a`[i:]+`a`[:i])for i in range(len(`a`))};print sum(b)/len(b)
```
EDIT: -6 bytes thanks to @ovs
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 11 bytes
```
Ｉ∕×ΣθＩ⭆θ1Ｌθ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEwyWzLDMlVSMkMze1WCO4NFejUFNHASwTXAJUle6bWKBRqKOgZKikqQmU8UnNSy/JACrS1LT@/9/E0sjiv25ZDgA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
    θ  θ  θ Input as a string
   Σ        Sum of digits
      ⭆ 1   Replace each character with the literal `1`
     Ｉ      Cast to integer
  ×         Multiply
         Ｌ  Length
 ∕          Divide
Ｉ           Cast to string
            Implicitly print
```
[Answer]
# [J](http://jsoftware.com/), 10 bytes
```
10#.#$+/%#
```
This is a port of H.PWiz's great APL solution to J.
Takes a list of digits as an argument.
## Explanation:
`+/%#` the average of the digits (divide `%` the sum of the digits `+/` by their number `#`)
`#$`creates a list of copies of the average according to the number of digits
`10#.` convert form base 10
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/DQ2U9ZRVtPVVlf9rcilwpSZn5CukKZgAoSmEhAkZKhgpGCPkLYFcCxjXHAT/AwA "J – Try It Online")
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 34 bytes
Takes input as a list of digits.
```
n->fromdigits([vecsum(n)|x<-n])/#n
```
[Try it online!](https://tio.run/##K0gsytRNL/ifpmCr8D9P1y6tKD83JTM9s6RYI7osNbm4NFcjT7OmwkY3L1ZTXznvf2JBQU6lRp6Crp1CQVFmXgmQqQTiKCmkARVq6ihERxvqGOkYxwJZJjqWQKYFhGmiY6oDJkFccx0gjI3V/A8A "Pari/GP – Try It Online")
[Answer]
## C++, ~~218~~ 208 bytes
-10 bytes thanks to Zacharý
```
#include<set>
#include<cmath>
float a(int m){std::set<int>a;int n=m,t,c=0;for(;n>0;n/=10)++c;for(;n<c;++n){a.insert(m);t=m%10;m=m/10+std::pow(10.f,c-1)*t;}int s=0;for(int v:a){s+=v;}return float(s)/a.size();}
```
And, to test :
```
int main() {
    printf("%f\n%f\n%f\n%f\n",a(123),a(4928),a(445445),a(777));
}
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 3 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
œÅA
```
Port of [*@tybocopperkettle*'s Vyxal answer](https://codegolf.stackexchange.com/a/252104/52210), so make sure to upvote him/her as well!
[Try it online](https://tio.run/##yy9OTMpM/f//6OTDrY7//xsaGQMA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/o5MPtzr@1/kfbWhkrGNiaWShY2JiCkQ65ubmsQA).
**Explanation:**
```
œ    # Get all permutations of the (implicit) input
     #  e.g. 123 → ["123","132","213","231","312","321"]
 ÅA  # Take the average of this list
     #  → 222.0
     # (which is output implicitly as result)
```
[Answer]
# [Thunno](https://github.com/Thunno/Thunno) `E`, \$ 9 \log\_{256}(96) \approx \$ 7.41 bytes
```
DLzP.ZDAA
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72sJKM0Ly9_abSSq1LsgqWlJWm6FitdfKoC9KJcHB0hfKjwgiUmlkYWEDYA)
Port of Vyxal.
#### Explanation
```
DLzP.ZDAA  # Implicit input. The E flag keeps it as a string.
DL         # Duplicate and get the length of the input string.
  zP       # Permutations of the input with the same length.
    .ZD    # Converted to integers from lists of characters.
       AA  # Get the average of this list of integers.
           # Implicit output.
```
[Answer]
# TI-Basic, 10 bytes
```
mean(Ans)int(1/9₁₀^(dim(Ans
```
Takes input in `Ans` as a list. Port of [Dennis's Python 3 answer](https://codegolf.stackexchange.com/a/162438/52210).
[Answer]
# Pyth, 12 bytes
```
csms.<zdlzlz
```
Probably improvable.
```
c         lz     Divide by the length of the input:
 s               Reduce by +
  m     lz       Map over d = [0 ... the length of the input]:
   s.<zd         Shift the input d characters to the left and cast to int
```
[Try it here!](http://pyth.herokuapp.com/?code=csms.%3Czdlzlz&input=123&test_suite=1&test_suite_input=123%0A4928%0A445445%0A777&debug=0)
[Answer]
# J, 23 Bytes
```
(+/%#)".~.(|."0 1~i.@#)
```
Takes input as a string
### Explanation
```
          (|."0 1~i.@#)  | All rotations
        ~.               | Deduplicate
      ".                 | Convert each to int
(+/%#)                   | Average
```
[Answer]
# Matlab, 65 bytes
```
c=num2str(n);l=nnz(c);mean(str2num(c(mod((1:l)+(0:l-1)'-1,l)+1)))
```
Gonna work on this, pretty sure it can be done better.
[Answer]
## Clojure, 139 bytes
```
#(let[n(count %)G(set(apply map list(for[i(range n)](take n(drop i(cycle %))))))](/(apply +(for[g G](read-string(apply str g))))(count G)))
```
Quite sub-optimal language features for converting sequences of characters to integers.
[Answer]
# dc, 37 bytes
This is a full program, reading input and printing the output:
```
?1sd[O~rzsadO<x+ldO*1+sd]dsxxOkld*la/p
```
It works by separating the number into its digits, and multiplying the mean of the digits by the appropriate length repdigit (which is built up in `d` as we go).
```
?                               # read input
 1sd                            # initialize d=1
    [                   ]dsxx   # define and execute recursive macro x:
     O~r                        #   remainder and quotient of /10
        zsa                     #   a = number of digits
           dO<x                 #   recurse if needed
               +ldO*1+sd        #   increment repdigit d
                             Ok         # after executing x, set precision 
                               ld*la/   # multiply by repdigit; divide by a
                                     p  # print the result
```
]