Skip to main content
added 1 character in body
Source Link
0xffcourse
  • 2.8k
  • 3
  • 14
  • 27

Recursiva, 2020 18 bytes

smBa++'=0%'Va'asmBa++'%'Va'a:a0!0'a'

Try it online!Try it online!

Explanation:

smBa++'=0%'Va'asmBa++'%'Va'a:a0!0'a' - Input to a; 20
s                    - sum up; 42
 m                   - map with; [1, 0, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15]
  Ba                 - Range; [1,2..20]
    ++'=0%'Va'a++'%'Va'a:a0!0'a'   - function, evaluates to 0 if param cannot divide a i.e. 20

Recursiva, 20 bytes

smBa++'=0%'Va'a:a!0'

Try it online!

Explanation:

smBa++'=0%'Va'a:a!0' - Input to a; 20
s                    - sum up; 42
 m                   - map with; [1, 0, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15]
  Ba                 - Range; [1,2..20]
    ++'=0%'Va'a:a!0' - function, evaluates to 0 if param cannot divide a i.e. 20

Recursiva, 20 18 bytes

smBa++'%'Va'a:0!a'

Try it online!

Explanation:

smBa++'%'Va'a:0!a' - Input to a; 20
s                    - sum up; 42
 m                   - map with; [1, 0, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15]
  Ba                 - Range; [1,2..20]
    ++'%'Va'a:0!a'   - function, evaluates to 0 if param cannot divide a i.e. 20
edited body
Source Link
0xffcourse
  • 2.8k
  • 3
  • 14
  • 27

Recursiva, 20 bytes

smBa++'=0%'Va'a:a!0'

Try it online!

Explanation:

smBa++'=0%'Va'a:a!0' - Input to a; 20
s                    - sum up; 42
 m                   - map with; [1, 0, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15]
  Ba                 - Range; [1,2..20]
    ++'=0%'Va'a:a!0' - function, evaluates to 0 if param cannot divide a; [20]a i.e. 20

Recursiva, 20 bytes

smBa++'=0%'Va'a:a!0'

Try it online!

Explanation:

smBa++'=0%'Va'a:a!0' - Input to a; 20
s                    - sum up; 42
 m                   - map with; [1, 0, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15]
  Ba                 - Range; [1,2..20]
    ++'=0%'Va'a:a!0' - function, evaluates to 0 if param cannot divide a; [20]  

Recursiva, 20 bytes

smBa++'=0%'Va'a:a!0'

Try it online!

Explanation:

smBa++'=0%'Va'a:a!0' - Input to a; 20
s                    - sum up; 42
 m                   - map with; [1, 0, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15]
  Ba                 - Range; [1,2..20]
    ++'=0%'Va'a:a!0' - function, evaluates to 0 if param cannot divide a i.e. 20
deleted 388 characters in body
Source Link
0xffcourse
  • 2.8k
  • 3
  • 14
  • 27

Recursiva, 3220 bytes

M+++"=1asmBa++'=0%'Va'a:1a!+|&=%"Vb"a0a0#~a$@"Vb0'

Try it online!Try it online!

Explanation:

M is similar to python's eval in recursiva. So, basically. we are building a string and evaluating it using M. Let's say we input 20 the string(everything following M) will be: =1a:1!+|&=%20a0a0#~a$@20. This is a recursiva function with parameter 20 passed into it and is recursive. The tail condition is given in =1a:1 which is saying for value of 1 simply returns 1. For other conditions we simply add the current number if it perfectly divides 20(The number we are interested in) else add 0 +|&=%"Vb"a0a0. The #~a$ part is making a call to the same function but with one decremented value ~a since ~ is minus-one operator.

smBa++'=0%'Va'a:a!0' - Input to a; 20
s                    - sum up; 42
 m                   - map with; [1, 0, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15]
  Ba                 - Range; [1,2..20]
    ++'=0%'Va'a:a!0' - function, evaluates to 0 if param cannot divide a; [20]  

Recursiva, 32 bytes

M+++"=1a:1!+|&=%"Vb"a0a0#~a$@"Vb

Try it online!

Explanation:

M is similar to python's eval in recursiva. So, basically. we are building a string and evaluating it using M. Let's say we input 20 the string(everything following M) will be: =1a:1!+|&=%20a0a0#~a$@20. This is a recursiva function with parameter 20 passed into it and is recursive. The tail condition is given in =1a:1 which is saying for value of 1 simply returns 1. For other conditions we simply add the current number if it perfectly divides 20(The number we are interested in) else add 0 +|&=%"Vb"a0a0. The #~a$ part is making a call to the same function but with one decremented value ~a since ~ is minus-one operator.

Recursiva, 20 bytes

smBa++'=0%'Va'a:a!0'

Try it online!

Explanation:

smBa++'=0%'Va'a:a!0' - Input to a; 20
s                    - sum up; 42
 m                   - map with; [1, 0, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15]
  Ba                 - Range; [1,2..20]
    ++'=0%'Va'a:a!0' - function, evaluates to 0 if param cannot divide a; [20]  
added 530 characters in body
Source Link
0xffcourse
  • 2.8k
  • 3
  • 14
  • 27
Loading
Source Link
0xffcourse
  • 2.8k
  • 3
  • 14
  • 27
Loading