Skip to main content
Commonmark migration
Source Link

#J, 30 27 19 chars#

J, 30 27 19 chars

Thanks to @Dennis for chopping off 3 characters.

Thanks to @Zgarb for chopping off 8 characters.

0:`(*[:+/%@q:@|)@.*

Try it online!

Sample input:

0:`(*[:+/%@q:@|)@.* _8
_12

0:`(*[:+/%@q:@|)@.* 0
0

0:`(*[:+/%@q:@|)@.* 8
12

How it works:

0:`(*[:+/%@q:@|)@.* N
XX`[email protected]   if Z then Y else X end
0:                        X:  return 0
                  Z       Z:  signum(N)
   (*[:+/%@q:@|)          Y:  N*add_all(reciprocal_all(all_prime_factors(abs(N))))
                              N
    *                          *
      [:+/                      add_all(                                         )
          %@                            reciprocal_all(                         )
            q:@                                       all_prime_factors(      )
               |                                                        abs( )
                                                                            N

#J, 30 27 19 chars#

Thanks to @Dennis for chopping off 3 characters.

Thanks to @Zgarb for chopping off 8 characters.

0:`(*[:+/%@q:@|)@.*

Try it online!

Sample input:

0:`(*[:+/%@q:@|)@.* _8
_12

0:`(*[:+/%@q:@|)@.* 0
0

0:`(*[:+/%@q:@|)@.* 8
12

How it works:

0:`(*[:+/%@q:@|)@.* N
XX`[email protected]   if Z then Y else X end
0:                        X:  return 0
                  Z       Z:  signum(N)
   (*[:+/%@q:@|)          Y:  N*add_all(reciprocal_all(all_prime_factors(abs(N))))
                              N
    *                          *
      [:+/                      add_all(                                         )
          %@                            reciprocal_all(                         )
            q:@                                       all_prime_factors(      )
               |                                                        abs( )
                                                                            N

J, 30 27 19 chars

Thanks to @Dennis for chopping off 3 characters.

Thanks to @Zgarb for chopping off 8 characters.

0:`(*[:+/%@q:@|)@.*

Try it online!

Sample input:

0:`(*[:+/%@q:@|)@.* _8
_12

0:`(*[:+/%@q:@|)@.* 0
0

0:`(*[:+/%@q:@|)@.* 8
12

How it works:

0:`(*[:+/%@q:@|)@.* N
XX`[email protected]   if Z then Y else X end
0:                        X:  return 0
                  Z       Z:  signum(N)
   (*[:+/%@q:@|)          Y:  N*add_all(reciprocal_all(all_prime_factors(abs(N))))
                              N
    *                          *
      [:+/                      add_all(                                         )
          %@                            reciprocal_all(                         )
            q:@                                       all_prime_factors(      )
               |                                                        abs( )
                                                                            N
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#J, 30 27 19 chars#

Thanks to @Dennis@Dennis for chopping off 3 characters.

Thanks to @Zgarb@Zgarb for chopping off 8 characters.

0:`(*[:+/%@q:@|)@.*

Try it online!

Sample input:

0:`(*[:+/%@q:@|)@.* _8
_12

0:`(*[:+/%@q:@|)@.* 0
0

0:`(*[:+/%@q:@|)@.* 8
12

How it works:

0:`(*[:+/%@q:@|)@.* N
XX`[email protected]   if Z then Y else X end
0:                        X:  return 0
                  Z       Z:  signum(N)
   (*[:+/%@q:@|)          Y:  N*add_all(reciprocal_all(all_prime_factors(abs(N))))
                              N
    *                          *
      [:+/                      add_all(                                         )
          %@                            reciprocal_all(                         )
            q:@                                       all_prime_factors(      )
               |                                                        abs( )
                                                                            N

#J, 30 27 19 chars#

Thanks to @Dennis for chopping off 3 characters.

Thanks to @Zgarb for chopping off 8 characters.

0:`(*[:+/%@q:@|)@.*

Try it online!

Sample input:

0:`(*[:+/%@q:@|)@.* _8
_12

0:`(*[:+/%@q:@|)@.* 0
0

0:`(*[:+/%@q:@|)@.* 8
12

How it works:

0:`(*[:+/%@q:@|)@.* N
XX`[email protected]   if Z then Y else X end
0:                        X:  return 0
                  Z       Z:  signum(N)
   (*[:+/%@q:@|)          Y:  N*add_all(reciprocal_all(all_prime_factors(abs(N))))
                              N
    *                          *
      [:+/                      add_all(                                         )
          %@                            reciprocal_all(                         )
            q:@                                       all_prime_factors(      )
               |                                                        abs( )
                                                                            N

#J, 30 27 19 chars#

Thanks to @Dennis for chopping off 3 characters.

Thanks to @Zgarb for chopping off 8 characters.

0:`(*[:+/%@q:@|)@.*

Try it online!

Sample input:

0:`(*[:+/%@q:@|)@.* _8
_12

0:`(*[:+/%@q:@|)@.* 0
0

0:`(*[:+/%@q:@|)@.* 8
12

How it works:

0:`(*[:+/%@q:@|)@.* N
XX`[email protected]   if Z then Y else X end
0:                        X:  return 0
                  Z       Z:  signum(N)
   (*[:+/%@q:@|)          Y:  N*add_all(reciprocal_all(all_prime_factors(abs(N))))
                              N
    *                          *
      [:+/                      add_all(                                         )
          %@                            reciprocal_all(                         )
            q:@                                       all_prime_factors(      )
               |                                                        abs( )
                                                                            N
deleted 234 characters in body
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284

#J, 30 2727 19 chars#

Thanks to @Dennis for chopping off 3 characters.

Thanks to @Zgarb for chopping off 8 characters.

0:`([*[*[:+/[:%@q:@%:@*:]@|)@.*
0:`([*[*[:+/[:%[:q:[:%:[:*%@q:]@|)@.* _8
_12

0:`([*[*[:+/[:%[:q:[:%:[:*%@q:]@|)@.* 0
0

0:`([*[*[:+/[:%[:q:[:%:[:*%@q:]@|)@.* 8
12
0:`([*[*[:+/[:%[:q:[:%:[:*%@q:]@|)@.* N
XX`YYYYYYYYYYYYYYYYYYYYYYYY@XX`YYYYYYYYYYYYY@.Z   if Z then Y else X end
0:                                   X:  return 0
                             Z       Z:  signum(N)
   ([*[*[:+/[:%[:q:[:%:[:*%@q:]@|)          Y:  N*add_all(reciprocal_all(all_prime_factors(abs(N))))
    [                                    N
     *                                    *
      [:+/                                 add_all(                                         )
          [:%@                                     reciprocal_all(                         )
              q:@                                                 all_prime_factors(      )
                  %:@*:     |                                                        abs( )
                  %:           sqrt(         )
                    @*:             square( )
                       ]                                                                N

Notes:

Too many exceptions to handle and too many caps needed...

#J, 30 27 chars#

Thanks to @Dennis for chopping off 3 characters.

0:`([*[:+/[:%@q:@%:@*:])@.*
0:`([*[:+/[:%[:q:[:%:[:*:])@.* _8
_12

0:`([*[:+/[:%[:q:[:%:[:*:])@.* 0
0

0:`([*[:+/[:%[:q:[:%:[:*:])@.* 8
12
0:`([*[:+/[:%[:q:[:%:[:*:])@.* N
XX`YYYYYYYYYYYYYYYYYYYYYYYY@.Z   if Z then Y else X end
0:                                   X:  return 0
                             Z       Z:  signum(N)
   ([*[:+/[:%[:q:[:%:[:*:])          Y:  N*add_all(reciprocal_all(all_prime_factors(abs(N))))
    [                                    N
     *                                    *
      [:+/                                 add_all(                                         )
          [:%@                                     reciprocal_all(                         )
              q:@                                                 all_prime_factors(      )
                  %:@*:                                                             abs( )
                  %:           sqrt(         )
                    @*:             square( )
                       ]                                                                N

Notes:

Too many exceptions to handle and too many caps needed...

#J, 30 27 19 chars#

Thanks to @Dennis for chopping off 3 characters.

Thanks to @Zgarb for chopping off 8 characters.

0:`(*[:+/%@q:@|)@.*
0:`(*[:+/%@q:@|)@.* _8
_12

0:`(*[:+/%@q:@|)@.* 0
0

0:`(*[:+/%@q:@|)@.* 8
12
0:`(*[:+/%@q:@|)@.* N
XX`YYYYYYYYYYYYY@.Z   if Z then Y else X end
0:                        X:  return 0
                  Z       Z:  signum(N)
   (*[:+/%@q:@|)          Y:  N*add_all(reciprocal_all(all_prime_factors(abs(N))))
                              N
    *                          *
      [:+/                      add_all(                                         )
          %@                            reciprocal_all(                         )
            q:@                                       all_prime_factors(      )
               |                                                        abs( )
                                                                            N
added 111 characters in body
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284
Loading
added 55 characters in body
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284
Loading
added 55 characters in body
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284
Loading
deleted 36 characters in body
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284
Loading
Post Undeleted by Leaky Nun
added 202 characters in body
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284
Loading
Post Deleted by Leaky Nun
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284
Loading