# Restricted average (arithmetic mean) – i.e. without obvious built-ins [closed]

### Introduction

The arithmetic mean is defined as being equal to the sum of the numerical values of each and every observation divided by the total number of observations. Symbolically, if we have a data set containing the values a1,…,an. The arithmetic mean A is defined by the formula ### Objective

The challenge here is, given a non-empty list of observations, to calculate the arithmetic mean without any built-ins for mean, sum, division, or count. All other operations are allowed, e.g. median, product, multiplication, and sequence generation.

If your language cannot process lists without knowing the number of elements it has, you may use a counting built-in for such (looping, loading, etc.) purpose only, but not for the actual computation.

### Test cases

5
[1,-2]-0.5
[6,1,3]3.333333333

If your language can handle complex numbers:

[5,1+3i]3+1.5i

• This is a cut-and-dry Do X without Y challenge.
– user45941
May 18 '16 at 7:24
• Possible duplicate of Operations with Lists
– user45941
May 18 '16 at 7:25
• @Mego How can it be a dup if the other one isn't a Do X without Y?
May 18 '16 at 8:11
• The core challenge is the same, and the "without Y" part doesn't significantly distinguish it.
– user45941
May 18 '16 at 8:12
• @Mego No the core here isn't list operations. It is alternative ways to do things.
May 18 '16 at 8:14

# Pyth, 13 bytes

l@*F^L2Qhe.ek


Try it online!

Uses exponential arithmetic to replace sum and division.

Uses enumerate to find number of elements.

• Perfect, that's the type of substitutions I had in mid.
May 18 '16 at 8:38

# Retina, 46 37 bytes

+x;
;x
;x
;;:x
;
x
^(x+):(\1)*x*
\$#2
`

Try it online!

It's quite a trouble not to use arithmetic...