Skip to main content

APL (Dyalog Unicode), 22 15 bytes

Anonymous tacit prefix function implementing $$f(x)=x_1\cdot\big[1=\lvert x\rvert\big]+\sum_{n=1}^{\lvert x\rvert}1^{\lvert x\rvert-n}\cdot\lvert x\rvert^{x_n}$$$$f(x)=x_1\cdot\big[1=\lvert x\rvert\big]+\log_{\lvert x \rvert} \sum_{n=1}^{\lvert x\rvert}1^{\lvert x\rvert-n}\cdot\lvert x\rvert^{x_n}$$

(⊃×1=≢)+≢⍟1⊥≢*⊢

Try it online!

(

 the first element

× times

1= whether (1) or not (0) one equals

the length of the argument

)+ plus

≢⍟ the length-logarithm of

1⊥ the sum (lit. the base-one evaluation) of

 the length

* raised to the power of (each element in)

 the argument

Old solution: APL (Dyalog Extended), 22 bytes

Anonymous prefix lambda.

{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}

Try it online!

{} "dfn"; argument is

0:: if any error happens:

1+ increment

⊃⍵ the first element of the argument

+/⍢()⍵ the sum of the argument, under the influence of:

()∘* raising to the power of:

≢⍵ the tally of elements (length of the argument)

APL (Dyalog Unicode), 22 15 bytes

Anonymous tacit prefix function implementing $$f(x)=x_1\cdot\big[1=\lvert x\rvert\big]+\sum_{n=1}^{\lvert x\rvert}1^{\lvert x\rvert-n}\cdot\lvert x\rvert^{x_n}$$

(⊃×1=≢)+≢⍟1⊥≢*⊢

Try it online!

(

 the first element

× times

1= whether (1) or not (0) one equals

the length of the argument

)+ plus

≢⍟ the length-logarithm of

1⊥ the sum (lit. the base-one evaluation) of

 the length

* raised to the power of (each element in)

 the argument

Old solution: APL (Dyalog Extended), 22 bytes

Anonymous prefix lambda.

{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}

Try it online!

{} "dfn"; argument is

0:: if any error happens:

1+ increment

⊃⍵ the first element of the argument

+/⍢()⍵ the sum of the argument, under the influence of:

()∘* raising to the power of:

≢⍵ the tally of elements (length of the argument)

APL (Dyalog Unicode), 22 15 bytes

Anonymous tacit prefix function implementing $$f(x)=x_1\cdot\big[1=\lvert x\rvert\big]+\log_{\lvert x \rvert} \sum_{n=1}^{\lvert x\rvert}1^{\lvert x\rvert-n}\cdot\lvert x\rvert^{x_n}$$

(⊃×1=≢)+≢⍟1⊥≢*⊢

Try it online!

(

 the first element

× times

1= whether (1) or not (0) one equals

the length of the argument

)+ plus

≢⍟ the length-logarithm of

1⊥ the sum (lit. the base-one evaluation) of

 the length

* raised to the power of (each element in)

 the argument

Old solution: APL (Dyalog Extended), 22 bytes

Anonymous prefix lambda.

{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}

Try it online!

{} "dfn"; argument is

0:: if any error happens:

1+ increment

⊃⍵ the first element of the argument

+/⍢()⍵ the sum of the argument, under the influence of:

()∘* raising to the power of:

≢⍵ the tally of elements (length of the argument)

add mathematical formula
Source Link
Adám
  • 31.1k
  • 3
  • 124
  • 287

APL (Dyalog Unicode), 22 15 bytes

Anonymous tacit prefix function. implementing $$f(x)=x_1\cdot\big[1=\lvert x\rvert\big]+\sum_{n=1}^{\lvert x\rvert}1^{\lvert x\rvert-n}\cdot\lvert x\rvert^{x_n}$$

(⊃×1=≢)+≢⍟1⊥≢*⊢

Try it online!

(

 the first element

× times

1= whether (1) or not (0) one equals

the length of the argument

)+ plus

≢⍟ the length-logarithm of

1⊥ the sum (lit. the base-one evaluation) of

 the length

* raised to the power of (each element in)

 the argument

Old solution: APL (Dyalog Extended), 22 bytes

Anonymous prefix lambda.

{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}

Try it online!

{} "dfn"; argument is

0:: if any error happens:

1+ increment

⊃⍵ the first element of the argument

+/⍢()⍵ the sum of the argument, under the influence of:

()∘* raising to the power of:

≢⍵ the tally of elements (length of the argument)

APL (Dyalog Unicode), 22 15 bytes

Anonymous tacit prefix function.

(⊃×1=≢)+≢⍟1⊥≢*⊢

Try it online!

(

 the first element

× times

1= whether (1) or not (0) one equals

the length of the argument

)+ plus

≢⍟ the length-logarithm of

1⊥ the sum (lit. the base-one evaluation) of

 the length

* raised to the power of (each element in)

 the argument

Old solution: APL (Dyalog Extended), 22 bytes

Anonymous prefix lambda.

{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}

Try it online!

{} "dfn"; argument is

0:: if any error happens:

1+ increment

⊃⍵ the first element of the argument

+/⍢()⍵ the sum of the argument, under the influence of:

()∘* raising to the power of:

≢⍵ the tally of elements (length of the argument)

APL (Dyalog Unicode), 22 15 bytes

Anonymous tacit prefix function implementing $$f(x)=x_1\cdot\big[1=\lvert x\rvert\big]+\sum_{n=1}^{\lvert x\rvert}1^{\lvert x\rvert-n}\cdot\lvert x\rvert^{x_n}$$

(⊃×1=≢)+≢⍟1⊥≢*⊢

Try it online!

(

 the first element

× times

1= whether (1) or not (0) one equals

the length of the argument

)+ plus

≢⍟ the length-logarithm of

1⊥ the sum (lit. the base-one evaluation) of

 the length

* raised to the power of (each element in)

 the argument

Old solution: APL (Dyalog Extended), 22 bytes

Anonymous prefix lambda.

{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}

Try it online!

{} "dfn"; argument is

0:: if any error happens:

1+ increment

⊃⍵ the first element of the argument

+/⍢()⍵ the sum of the argument, under the influence of:

()∘* raising to the power of:

≢⍵ the tally of elements (length of the argument)

-7
Source Link
Adám
  • 31.1k
  • 3
  • 124
  • 287

APL (Dyalog Extended)APL (Dyalog Unicode), 2222 15 bytes

Anonymous tacit prefix function.

(⊃×1=≢)+≢⍟1⊥≢*⊢

Try it online!

(

 the first element

× times

1= whether (1) or not (0) one equals

the length of the argument

)+ plus

≢⍟ the length-logarithm of

1⊥ the sum (lit. the base-one evaluation) of

 the length

* raised to the power of (each element in)

 the argument

Old solution: APL (Dyalog Extended), 22 bytes

Anonymous prefix lambda.

{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}

Try it online!

{} "dfn"; argument is

0:: if any error happens:

1+ increment

⊃⍵ the first element of the argument

+/⍢()⍵ the sum of the argument, under the influence of:

()∘* raising to the power of:

≢⍵ the tally of elements (length of the argument)

APL (Dyalog Extended), 22 bytes

Anonymous prefix lambda.

{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}

Try it online!

{} "dfn"; argument is

0:: if any error happens:

1+ increment

⊃⍵ the first element of the argument

+/⍢()⍵ the sum of the argument, under the influence of:

()∘* raising to the power of:

≢⍵ the tally of elements (length of the argument)

APL (Dyalog Unicode), 22 15 bytes

Anonymous tacit prefix function.

(⊃×1=≢)+≢⍟1⊥≢*⊢

Try it online!

(

 the first element

× times

1= whether (1) or not (0) one equals

the length of the argument

)+ plus

≢⍟ the length-logarithm of

1⊥ the sum (lit. the base-one evaluation) of

 the length

* raised to the power of (each element in)

 the argument

Old solution: APL (Dyalog Extended), 22 bytes

Anonymous prefix lambda.

{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}

Try it online!

{} "dfn"; argument is

0:: if any error happens:

1+ increment

⊃⍵ the first element of the argument

+/⍢()⍵ the sum of the argument, under the influence of:

()∘* raising to the power of:

≢⍵ the tally of elements (length of the argument)

Source Link
Adám
  • 31.1k
  • 3
  • 124
  • 287
Loading