Skip to main content
added 905 characters in body
Source Link
Zgarb
  • 42.8k
  • 4
  • 79
  • 259

Husk, 19 bytes

#ȯV<⁰Sz≠↔§f`¦ḣḣ□100

No TIO link, since it times out. This version uses 100 in place of 10000 and finishes in a couple of seconds. Explanation coming soon

Explanation

Husk has no divisors built-in or support for scientific notation yet.

#ȯV<⁰Sz≠↔§f`¦ḣḣ□100  Input is n (accessed with ⁰).
               □100  Square of 100: 10000
              ḣ      Inclusive range from 1.
#                    Count number of elements for which
 ȯ                   this composition of 3 functions gives truthy result:
                       Argument k, say k = 12.
         §f`¦ḣ         Divisors of k:
             ḣ           Range: [1,2,3,..,12]
         §f              Filter by
           `¦            divides k: [1,2,3,4,6,12]
     Sz≠↔              Absolute differences of divisor pairs:
        ↔                Reverse: [12,6,4,3,2,1]
     Sz                  Zip with divisor list
       ≠                 using absolute difference: [11,4,1,1,4,11]
  V<⁰                  Is any of these less than n?

Husk, 19 bytes

#ȯV<⁰Sz≠↔§f`¦ḣḣ□100

No TIO link, since it times out. This version uses 100 in place of 10000 and finishes in a couple of seconds. Explanation coming soon.

Husk, 19 bytes

#ȯV<⁰Sz≠↔§f`¦ḣḣ□100

No TIO link, since it times out. This version uses 100 in place of 10000 and finishes in a couple of seconds.

Explanation

Husk has no divisors built-in or support for scientific notation yet.

#ȯV<⁰Sz≠↔§f`¦ḣḣ□100  Input is n (accessed with ⁰).
               □100  Square of 100: 10000
              ḣ      Inclusive range from 1.
#                    Count number of elements for which
 ȯ                   this composition of 3 functions gives truthy result:
                       Argument k, say k = 12.
         §f`¦ḣ         Divisors of k:
             ḣ           Range: [1,2,3,..,12]
         §f              Filter by
           `¦            divides k: [1,2,3,4,6,12]
     Sz≠↔              Absolute differences of divisor pairs:
        ↔                Reverse: [12,6,4,3,2,1]
     Sz                  Zip with divisor list
       ≠                 using absolute difference: [11,4,1,1,4,11]
  V<⁰                  Is any of these less than n?
Source Link
Zgarb
  • 42.8k
  • 4
  • 79
  • 259

Husk, 19 bytes

#ȯV<⁰Sz≠↔§f`¦ḣḣ□100

No TIO link, since it times out. This version uses 100 in place of 10000 and finishes in a couple of seconds. Explanation coming soon.