text:
Integers sorted by their digital roots
The digital root (also repeated digital sum) of a positive integer is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached.
For example, the digital root of 65536 is 7, because 6 + 5 + 5 + 3 + 6 = 25 and 2 + 5 = 7.

Sorting all digital roots doesn't make much sense, since it would just start with infinitely many 1s.
Instead, we'll create lists of all the single digits integers along with their digital roots, then all double digit numbers along with their digital roots, then the triple, quadruple and so on.
Now, for each of those lists, we'll sort it so that all the integers with digital roots of 1 appear first, then all integers with digital roots of 2 and so on. The sorting will be stable, so that the list of integers with a certain digital roots should be in ascending order after the sorting.
Finally we'll concatenate these lists into one single sequence. This sequence will start with all single digit numbers, then all double digit numbers (sorted by their digital root), then all triple digit numbers and so on.

Challenge:
Take a positive integer n as input, and output the n'th number in the sequence described above. You may choose if the list is 0-indexed of 1-indexed.
The sequence goes like this:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 28, 37, 46, 55, 64, 73, 82, 91, 11, 20, 29 ...
72, 81, 90, 99, 100, 109, 118, ...
981, 990, 999, 1000, 1009, 1018, 1027, ...

Test cases:
The test cases are 1-indexed.
   n   f(n)
   9      9
  10     10
  11     19
  40     13
  41     22
  42     31
  43     40
  44     49
  45     58
 600    105
 601    114
 602    123
 603    132
 604    141
 605    150
4050   1453
4051   1462
4052   1471
4053   1480
4054   1489
4055   1498

Easier to copy:
n =    9, 10, 11, 40, 41, 42, 43, 44, 45, 600, 601, 602, 603, 604, 605, 4050, 4051, 4052, 4053, 4054, 4055,
f(n) = 9, 10, 19, 13, 22, 31, 40, 49, 58, 105, 114, 123, 132, 141, 150, 1453, 1462, 1471, 1480, 1489, 1498

Clarifications:

You may not output all n first elements. You shall only output the n'th.
The code must theoretically work for all integers up to 10^9, but it's OK if it times out on TIO (or other interpreters with time restrictions) for inputs larger than 999.
Explanations are encouraged.

It's code-golf, so the shortest code in each language wins! Don't be discouraged by other solutions in the language you want to golf in, even if they are shorter than what you can manage!

Fun note: this is not in OEIS yet

Python 2, 78 60 52 46 45 bytes
-6 bytes thanks to G B.
-1 byte thanks to Jakob.
n=input()
b=10**~-len(`n`)
print~-b+n/b+n%b*9

Try it online!
Finally reached a closed form, 1-indexed.

Python 2, 78 bytes
0-indexed.
d=10;k=1
exec'\nk+=9\nif k>d+7:k=d;d*=10\nif k>=d:k-=d/10*9-1'*input()
print k

Try it online!

I was hoping to see a solution that didn't create the entire sequence. Well done :-)

How did you derive the closed form solution? (edit: looks like there's an explanation on wikipedia)

@sevko The 78-byter was my original solution (somewhat ungolfed variant here). This already works without calculating any cube roots, but rather by generating the sequence number by number, based on rules I observed in the sequence. Based on this iterative calculations one can count how many times each expression gets executed.

@sevko with the help of WolframAlpha I was able to construct a closed form. At first the program using the closed form was a lot longer (~95 bytes) but with some golfing and WolframAlpha this got to its current form.

Python 3, 80 bytes
f=lambda i,k=1:k>i and sorted(range(k//10,k),key=lambda n:n%-9)[i-k]or f(i,k*10)

Try it online!
1-indexed. This is the best I could manage in Python 3 (well, except for the 78-byter, which is a port of my Python 2 solution below; I think this one is much cooler, though). Python 2 full programs are advantaged for this particular challenge, because input() needs a conversion to int in Python 3 (+5 bytes), exec is a function, rather than a statement (+2 bytes) and / performs integer division by default if its arguments are integers in Py 2 (+1 byte), so this is definitely shorter than porting ovs' answer.
How it works
Setup
f=lambda i,k=1:k>i and ... or f(i,k*10)

This defines a recursive function f that takes one integer argument i and another one, k, which defaults to 1. While k ≤ i, the function f returns f(i,10k), multiplying k by 10 each time until it becomes greater than i.
Target range and correct indexing
...range(k//10,k)...[i-k]

After this set of operation, we're left with i, the initial input and the variable k which represents the smallest power of 10 greater than i. This way, we are able to generate the (integer) range [floor(k/10), k), which basically includes all integers that are:

greater than or equal to the highest power of 10 less than or equal to i
less than k, the smallest power of 10 greater than i

Since we disregard the integers smaller than x = floor(k/10), we must shift the indexing so that we account for the missing numbers. The obvious way is to subtract their count, x, from i, so that we index into the list (after sorting, which is described below), therefore having i-x. However, since the list contains 9k/10, items, and indexing in a list at index -y for some positive y yields the yth element from the end in Python, this is simply equivalent to indexing with i-k, hence saving 4 bytes.
Sorting each chunk by the digital root
sorted(...,key=lambda n:n%-9)

The formula for the digital root function is 1+((n-1) mod 9) (see the Congruence formula section of this Wikipedia article). As 1 would this way be added to each of them, it is superfluous when sorting, so we're left with (n-1) mod 9. The way Python's % operator works when given negative numbers on the RHS is very convenient, because we can use n pymod -9 instead to save yet anther byte.

Python 2, 72 bytes
Inspired by Chas Brown's submission.
lambda i:sorted(range(1,10**len(`i`)),key=lambda n:(len(`n`),n%-9))[i-1]

Try it online!

Python 2, 73 71 70 bytes
lambda n:sorted(range(10**len(`n`)),key=lambda i:(len(`~i`),i%9))[n]+1

Try it online!
2 bytes thx to Mr. XCoder; and
1 byte thx to H.PWiz.
This is 0-indexed.

Well, i%9 should be sufficient instead of i%9+1... this way you beat my 72 byter :DD:

@Mr.Xcoder: Ha! You're right...

len(\~i`)` should work

Jelly,  15 14 10  9 bytes
D,Ḣ$‘Ḍḅ9’

Try it online!
How?
Uses a golfed version of the closed-form solution created by ovs in their Python answer...
The formula exposed by ovs is: 9*(n%b) + (n/b) + b - 1 where b=10floor(log(n,10))
Now if c is the count of decimal digits of n then b-1 is c-1 nines in decimal.
This is the same as nine times the value of c-1 ones in decimal (e.g. 111*9=999).
Furthermore n/b is the leading digit of n and n%b is the rest of the digits as a decimal number.
A formula like b*x+y may be implemented as a conversion of [x,y] from base b
(i.e. b^1*x + b^0*y = b*x+y)
As such we can take a number, n (for example 7045), split it into the leading and trailing digits, placing the leading digit at the end ([[0,4,5],7]), add one to all of the digits of the first item to cater for the addition of b-1 ([[1,5,6],7]) convert these from decimal lists to integers ([156,7]), and convert that from base nine (1411).
In the implementation below we add one to all of the digits of both items when catering for b-1 ([[0,4,5],8]), convert from decimal lists to integers ([156,8]), convert from base nine (1412) and then subtract the one this process added (1411).
D,Ḣ$‘Ḍḅ9’ - Link: positive integer, n    e.g. 4091
D         - to base ten                       [4, 0, 9, 1]
   $      - last two links as a monad:
  Ḣ       -   head (modifies the list too)    4
 ,        -   pair (the modified list) with   [[0, 9, 1], 4]
    ‘     - increment (vectorises)            [[1, 10, 2], 5]
     Ḍ    - from base ten (vectorises)        [202, 5] (since 1*10^2+10*10^1+2*10^0 = 100+100+2 = 202)
      ḅ9  - convert from base 9               1823 (since 202*9^1 + 5*9^0 = 202*9 + 6*9 = 1818 + 5 = 1823)
        ’ - decrement                         1822

Previous, 14 byter:
æċ⁵DL,’%9ƊƲÞị@

Try it online!
This one builds the list up to the next power of 10 above the input by sorting these natural numbers by [digitalRoot, digitCount] then finds the value at the inputted index.

Haskell, 94 88 bytes
([n|x<-[0..],i<-[1..9],n<-[10^x..10^(x+1)-1],until(<10)(sum.map(read.pure).show)n==i]!!)

Try it online! 0-indexed.
Explanation:
The list comprehension generates the sequence as infinite list in which we index with !!:

x is one less than the current number of digits and is drawn from the infinite list [0,1,2,3, ...]
i iterates over the range from 1 to 9 and is used for sorting by the digital roots
n iterates over all numbers with x+1 digits
until(<10)(sum.map(read.pure).show) computes the digital root (see here for an explanation)
n is added to the list if its digital root equals i.

Pyth,  36 31 25 24 23  22 bytes
1-indexed.
@o%tN9rFK^LThBlt`Q-QhK

Test suite!
How it works (outdated)
@smo%tN9dcU^TKhs.lQT^LTSK – Full program. Q = input.
             Khs.lQT      – Take floor(log10(Q))+1 and store it in K.
          U^T             – Generate [0 ... T^K).
         c                – Cut at locations...
                    ^LTSK – Of the powers of 10 less than K.
  m     d                 – Map over those.
   o  N                   – Sort them by...
    %t 9                  – Themselves decremented, modulo 9.
@s                        – Flatten the result and retrieve the Q'th entry.

Retina, 65 bytes
.
9
.+
*
L$`
$`
O$`_(_{9})*(_*)
$2
_+
$.&
N$`
$.&
"$+L`^|\d+"^~G`

Try it online! 1-indexed. Explanation:
.
9
.+
*
L$`
$`

Build up a list of lines of _s from 0 until the next power of 10 (exclusive).
O$`_(_{9})*(_*)
$2

Sort them all in order of digital root.
_+
$.&

Convert from unary to decimal.
N$`
$.&

Sort them in order of length.
"$+L`^|\d+"^~G`

Extract the nth element.

05AB1E, 19 11 bytes
Port of my Python answer.
-6 bytes(!) thanks to Kevin Cruijssen.
g<°©‰`9*®O<

Try it online!
Code           Explanation            Stack
               implicit input         [n]
g              length                 [len(n)]
 <             decrement              [len(n)-1]
  °            10 ** a                [10**(len(n) - 1)]
   ©           store value            [10**(len(n) - 1)]
    ‰          divmod                 [[n // 10**(len(n) - 1), n % 10**(len(n) - 1)]]
     `         push items to stack    [n // 10**(len(n) - 1), n % 10**(len(n) - 1)]
      9*       multiply by 9          [n // 10**(len(n) - 1), n % 10**(len(n) - 1) * 9]
        ®      retrieve value         [n // 10**(len(n) - 1), n % 10**(len(n) - 1) * 9, 10**(len(n) - 1)]
         O     sum the stack          [n // 10**(len(n) - 1) + n % 10**(len(n) - 1) * 9 + 10**(len(n) - 1)]
          <    decrement              [n // 10**(len(n) - 1) + n % 10**(len(n) - 1) * 9 + 10**(len(n) - 1) - 1]
               implicit output

You beat me to it, was working on an answer that was a port of your Python answer. ;) 13 bytes: g<°©÷¹®%9*®O<. Here the explanation I was about to post for it.

@KevinCruijssen thanks a lot. The register seems to be quite useful. I was able to get it down two more bytes using divmod.

Pyth, 23 bytes
@o%tN9rF_mJ^TsdtBl`Q-QJ

Try it here.
-3 thanks to Mr. Xcoder
1-indexed.

Perl 6,  68  58 bytes
{({|(10**$++..^10**++$).sort({({.comb.sum}…*==*).tail})}…*)[$_]}

Test it 0-based
{sort({.chars,({.comb.sum}…*==*).tail},^10**.chars)[$_]}

Test it 1-based
Expanded:
{  # bare block lambda with implicit parameter $_

  sort(
    {
      .chars,         # sort by the length first

      (  # generate sequence to find digital sum

        { .comb.sum } # one round of digital sum
        … * == *      # stop when the digital sum matches itself (1..9)

      ).tail          # get the last value
    },

    ^                 # Range up to (and excluding)
      10 ** .chars    # the next power of 10

  )[ $_ ] # index into the sequence
}

Ruby, 43 38 bytes
->x{9*(x%b=10**~-x.to_s.size)+x/b+b-1}

Try it online!
Originally a port of the excellent Python answer by ovs, then simplified some more.

Java 8, 68 bytes
n->{int b=(int)Math.pow(10,(n+"").length()-1);return~-b+n/b+n%b*9;}

Boring port of @ovs' Python 2 answer, so make sure to upvote him!
-1 byte thanks to @Jakob
Try it online.

K4, 38 bytes
Solution:
-1+9/:10/:'(0;c-1)_1_(1+c:#x)#x:1+10\:

Examples:
q)k)-1+9/:10/:'(0;c-1)_1_(1+c:#x)#x:1+10\:40
13
q)k)-1+9/:10/:'(0;c-1)_1_(1+c:#x)#x:1+10\:601
114
q)k)-1+9/:10/:'(0;c-1)_1_(1+c:#x)#x:1+10\:4051
1462

Explanation:
Port of Jonathan Allan's solution as I run out of memory building the digital roots from 1 to 1e9.
-1+9/:10/:'(0;c-1)_1_(1+c:#x)#x:1+10\: / the solution
                                  10\: / convert to base 10
                                1+     / add 1
                              x:       / save as x
                             #         / take from x
                     (      )          / do together
                          #x           / count x
                        c:             / save as c
                      1+               / add 1
                   1_                  / drop the first
                  _                    / cut at these indices
           ( ;   )                     / 2-item list
              c-1                      / length - 1
            0                          / .. zero
      10/:'                            / convert each from base 10
   9/:                                 / convert from base 9
-1+                                    / subtract 1

Bonus:
Translation of ovs' solution is simpler but longer:
-1+b+/1 9*(_%;.q.mod).\:x,b:10 xexp#1_$x:

It's explicitly stated that: "The code must theoretically work for all integers up to 10^9". It appears this does not...?

Urgh. Then I'll use one of the bonus answers as I'll run out of memory trying to calculate up to 10e6 let alone 10e9. Will fix later.

Jelly, 19 bytes
æḟ©ræċɗ⁵Ṗ%Þ-9⁸‘_®¤ị

Try it online!
-1 thanks to Mr. Xcoder.
1-indexed.

J, 24 bytes
(]/:([:+/[:".&>":)^:_"0)

This tacit expression is wrapped in parens to signify that it should be treated on its own rather than as part of any following expression (like the arguments).
The phrase ']/:' orders (ascending '/:') the original array ']' by the sum '+/' of the digits The expression
". &> ":

 converts a number to a character vector with '":', then applies its inverse '".'  - character to number - applied to each '&>' item.  So, 65536 -> '65536' -> 6 5 5 3 6.
The power conjunction '^:' near the end of the expression applies the code we just explained (on the left) a specified number of times.  In this case, the specified number of times is infinity '_' which means to keep applying until the result stops changing.
The final '"0' means to apply the whole expression on the left to each scalar (0-dimensional) item on the right, which would be the array of numbers to which we want to apply this.

How are you creating the input list(s)? I'm writing a solution in K but half the answer is generating the lists...

I assumed the lists are input externally.  I don't see where creating the list is part of the problem.

"Take a positive integer n as input, and output the n'th number in the sequence described above." You have to create the sequence (or find a way to get around generating the sequence - see other answers).

Elixir, 239 bytes
q=:math
e=Enum
r=fn x,f->cond do
x<10->x
1->f.(e.sum(Integer.digits x),f)end end
fn p->e.at(e.at(Stream.unfold({0,[0]},fn {a,c}->{c,{a+1,c++e.sort(trunc(q.pow 10,a)..trunc(q.pow 10,a+1)-1,&r.(&1,r)<=r.(&2,r))}}end),1+trunc q.log10 p),p)end

Try it online!
Explanation incoming (slowly)! I don't think it can get much shorter than this, but I'm always open to suggestions

Perl 5 -pF, 27 bytes
$_=9x$#F+$_%10**$#F*9+$F[0]

Try it online!
Uses @ovs's formula and @JonathanAllen's explanations to come up with a nice compact piece of code.


text:
Number the positive rationals
The positive rational numbers can be shown to be numerable with the following process:

Zero has the ordinal 0
Arrange the other numbers in a grid so that row a, column b contains a/b
Plot a diagonal zig-zag top right to bottom left
Keep a running tally of the unique numbers encountered along the zig-zag

Here's a picture of the zig-zag:

So, the numbers encountered are, in order
1/1, 2/1, 1/2, 1/3, 2/2, 3/1, 4/1, 3/2, 2/3, 1/4, 1/5, 2/4, 3/3, 4/2, 5/1, 6/1, 5/2, 4/3, 3/4, 2/5, 1/6, 1/7, 2/6, 3/5, 4/4, 5/3 ...

And the simplified, unique numbers encountered are
1, 2, 1/2, 1/3, 3, 4, 3/2, 2/3, 1/4, 1/5, 5, 6, 5/2, 4/3, 3/4, 2/5, 1/6, 1/7, 3/5, 5/3, ...

Challenge:

Given two greater-than-zero integers p and q, output the ordinal number of p/q
p and q are not necessarily co-prime
Shortest code wins
Standard loopholes are prohibited

Test cases:
Here are the first 24 rational numbers encountered, and the desired output for each:
1/1: 1
2/1: 2
1/2: 3
1/3: 4
2/2: 1
3/1: 5
4/1: 6
3/2: 7
2/3: 8
1/4: 9
1/5: 10
2/4: 3
3/3: 1
4/2: 2
5/1: 11
6/1: 12
5/2: 13
4/3: 14
3/4: 15
2/5: 16
1/6: 17
1/7: 18
2/6: 4
3/5: 19

And, for further test cases, here are the 200 first positive rational numbers in order:
1, 2, 1/2, 1/3, 3, 4, 3/2, 2/3, 1/4, 1/5,
5, 6, 5/2, 4/3, 3/4, 2/5, 1/6, 1/7, 3/5, 5/3,
7, 8, 7/2, 5/4, 4/5, 2/7, 1/8, 1/9, 3/7, 7/3,
9, 10, 9/2, 8/3, 7/4, 6/5, 5/6, 4/7, 3/8, 2/9,
1/10, 1/11, 5/7, 7/5, 11, 12, 11/2, 10/3, 9/4, 8/5,
7/6, 6/7, 5/8, 4/9, 3/10, 2/11, 1/12, 1/13, 3/11, 5/9,
9/5, 11/3, 13, 14, 13/2, 11/4, 8/7, 7/8, 4/11, 2/13,
1/14, 1/15, 3/13, 5/11, 7/9, 9/7, 11/5, 13/3, 15, 16,
15/2, 14/3, 13/4, 12/5, 11/6, 10/7, 9/8, 8/9, 7/10, 6/11,
5/12, 4/13, 3/14, 2/15, 1/16, 1/17, 5/13, 7/11, 11/7, 13/5,
17, 18, 17/2, 16/3, 15/4, 14/5, 13/6, 12/7, 11/8, 10/9,
9/10, 8/11, 7/12, 6/13, 5/14, 4/15, 3/16, 2/17, 1/18, 1/19,
3/17, 7/13, 9/11, 11/9, 13/7, 17/3, 19, 20, 19/2, 17/4,
16/5, 13/8, 11/10, 10/11, 8/13, 5/16, 4/17, 2/19, 1/20, 1/21,
3/19, 5/17, 7/15, 9/13, 13/9, 15/7, 17/5, 19/3, 21, 22,
21/2, 20/3, 19/4, 18/5, 17/6, 16/7, 15/8, 14/9, 13/10, 12/11,
11/12, 10/13, 9/14, 8/15, 7/16, 6/17, 5/18, 4/19, 3/20, 2/21,
1/22, 1/23, 5/19, 7/17, 11/13, 13/11, 17/7, 19/5, 23, 24,
23/2, 22/3, 21/4, 19/6, 18/7, 17/8, 16/9, 14/11, 13/12, 12/13,
11/14, 9/16, 8/17, 7/18, 6/19, 4/21, 3/22, 2/23, 1/24, 1/25

Shout out to the inverse question, where the first move is down so you can't use the answers to generate additional test cases.

I wonder if there are alternative numbering schemes that make for shorter code.

Numerators of fractions: http://oeis.org/A157807 denominators: http://oeis.org/A157813 No matches for ordinal sequence: http://oeis.org/search?q=1%2C2%2C3%2C4%2C1%2C5%2C6%2C7%2C8%2C9%2C10%2C3&sort=&language=&go=Search

i see. you have to reduce the fraction and then count. its not the zig-zag only

Related: Zigzagify a Matrix and Reconstruct a zigzagified matrix.

Jelly,  21  20 bytes
Probably beatable by a number of bytes using some clever mathematics...
:g/
ÇµSRRUĖ€UÐeẎÇ€Qi

A monadic link accepting a list of [p,q] which returns the natural number assigned to p/q.
Try it online! Or see the test-suite.
How?
First note that the Nth diagonal encountered contains all of the grid's rational numbers for which the sum of the numerator and denominator equals N+1, so given a function which reduces a [p,q] pair to simplest form ([p/gcd(p,q),q/gcd(p,q)]) we can build the diagonals as far as need be*, reduce all the entries, de-duplicate and find the index of the simplified input.
* actually one further here to save a byte
:g/ - Link 1, simplify a pair: list of integers, [a, b]
  / - reduce using:
 g  - Greatest Common Divisor -> gcd(a, b)
:   - integer division (vectorises) -> [a/gcd(a,b), b/gcd(a,b)]

ÇµSRRUĖ€UÐeẎÇ€Qi - Main Link: list of integers, [p, q]
Ç                - call last Link as a monad (simplify)
 µ               - start a new monadic chain (call that V)
  S              - sum -> the diagonal V will be in plus one
   R             - range -> [1,2,3,...,diag(V)+1]
    R            - range (vectorises) -> [[1],[1,2],[1,2,3],...,[1,2,3,...,diag(V)+1]]
     U           - reverse each       -> [[1],[2,1],[3,2,1],[diag(V)+1,...,3,2,1]]
      Ė€         - enumerate €ach     -> [[[1,1]],[[1,2],[2,1]],[[1,3],[2,2],[3,1]],[[1,diag(V)+1],...,[diag(V)-1,3],[diag(V),2],[diag(V)+1,1]]]
         Ðe      - apply only to the even indexed items:
        U        -   reverse each     -> [[[1,1]],[[2,1],[1,2]],[[1,3],[2,2],[3,1]],[[4,1],[3,2],[2,3],[1,4]],...]
           Ẏ     - tighten            -> [[1,1],[2,1],[1,2],[1,3],[2,2],[3,1],[4,1],[3,2],[2,3],[1,4],...]
            Ç€   - for €ach: call last Link as a monad (simplify each)
                 -                    -> [[1,1],[2,1],[1,2],[1,3],[1,1],[3,1],[4,1],[3,2],[2,3],[1,4],...]
              Q  - de-duplicate       -> [[1,1],[2,1],[1,2],[1,3],[3,1],[4,1],[3,2],[2,3],[1,4],...]
               i - index of V in that list

Perl 6,  94  90 bytes
->\p,\q{(({|(1…($+=2)…1)}…*)Z/(1,{|(1…(($||=1)+=2)…1)}…*)).unique.first(p/q,:k)+1}

Test it
{(({|(1…($+=2)…1)}…*)Z/(1,{|(1…(($||=1)+=2)…1)}…*)).unique.first($^p/$^q):k+1}

Test it
This basically generates the entire sequence of values, and stops when it finds a match.
Expanded:
{  # bare block lambda with placeholder parameters $p,$q

  (
      ( # sequence of numerators

        {
          |( # slip into outer sequence (flatten)

            1      # start at one
            …
            (
              $    # state variable
              += 2 # increment it by two each time this block is called
            )
            …
            1      # finish at one
          )

        }
        … * # never stop generating values
      )

    Z/   # zip using &infix:« /  » (generates Rats)

      ( # sequence of denominators

        1,  # start with an extra one

        {
          |( # slip into outer sequence (flatten)

            1
            …
            (
              ( $ ||= 1 ) # state variable that starts with 1 (rather than 0)
              += 2        # increment it by two each time this is called
            )
            …
            1
          )
        }
        … * # never stop generating values
      )

  ).unique            # get only the unique values
  .first( $^p / $^q ) # find the first one that matches the input
  :k                  # get the index instead (0 based)
  + 1                 # add one               (1 based)
}

({1…($+=2)…1}…*) generates the infinite sequence of numerators (|(…) is used above to flatten)
(1 2 1)
(1 2 3 4 3 2 1)
(1 2 3 4 5 6 5 4 3 2 1)
(1 2 3 4 5 6 7 8 7 6 5 4 3 2 1)
(1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1)
…

(1,{1…(($||=1)+=2)…1}…*) generates the infinite sequence of denominators
1
(1 2 3 2 1)
(1 2 3 4 5 4 3 2 1)
(1 2 3 4 5 6 7 6 5 4 3 2 1)
(1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1)
(1 2 3 4 5 6 7 8 9 10 11 10 9 8 7 6 5 4 3 2 1)
…

Python 3, 157, 146, 140, 133 bytes
def f(p,q):a=[(i+i-abs(j-i-i))/(abs(j-i-i+.5)+.5)for i in range(p+q)for j in range(4*i)];return sorted(set(a),key=a.index).index(p/q)

Try it online!
won 11 bytes thanks to Jonathan Frech
won 6 more bytes and then 7 thanks to Chas Brown

146 bytes.

140 bytes.

@bobrobbob: Welcome to PPCG! I'm not quite sure how your algorithm works (although it clearly does); but experimentally, it seems you can save some more bytes by replacing range(max(p,q)+1) with range(p+q).

You can save some more bytes by using {*a} instead of set(a).

Python 2, 157 144 137 134 126 125 bytes
def f(p,q):a=[((j-i)/(i+1.))**(j%-2|1)for j in range(p-~q)for i in range(j)];return-~sorted(set(a),key=a.index).index(p*1./q)

Try it online!
4 bytes saved due to Mr. Xcoder;
1 byte from Jonathon Frech.
As noted by Mr. Xcoder, we can do a bit better in Python 3 since, amongst other things, integer division defaults to float results, and we can more easily unpack lists:
Python 3, 117 bytes
def f(p,q):a=[((j-i)/-~i)**(j%-2|1)for j in range(p-~q)for i in range(j)];return-~sorted({*a},key=a.index).index(p/q)

Try it online!

128 bytes (-6) by swapping the fraction and using **(j%-2|1) and p-~q.

@Mr. Xcoder: You're all about the negative modulo today! :) I think I still need the +1 at the end, since 1,1 'must' give 1, not 0.

125 bytes.

124 bytes :) Yeah the negative modulo turns out to be really helpful!

Actually 117 bytes in Python 3

I'm always a bit reticent to switch from 2.7 to 3.x when golfing an answer - I admit, I'm a prig! :).

J, 41, 35, 30 bytes
-11 bytes thanks to FrownyFrog
%i.~0~.@,@,[:]`|./.[:%/~1+i.@*

Try it online!
original 41 bytes post with explanation
%>:@i.~[:([:~.@;[:<@|.`</.%"1 0)~(1+i.@*)

ungolfed
% >:@i.~ [: ([: ~.@; [: <@|.`</. %"1 0)~ 1 + i.@*

explanation
                  +
                  | Everything to the right of this
                  | calculates the list
p (left arg)      |                                      create the
divided by q      |                                      diagonals.  yes,
      (right)     |                                     +this is a         +create this list
   |              |        ++ finally rmv ^alternately  |primitive ADVERB  |1..(p*q), and pass
   |   + the index          | the boxes,  |box, or      |in J              |it as both the left
   |   | of that  |         | and remove  |reverse and  |                  |and right arg to the
   |   | in the   |         | any dups    |box, each    |                  |middle verb, where each
   |   | list on  |         |             |diagonal     |                  |element will divide the
   |   | the right|         |             |             |       +----------+entire list, producing
   |   | plus 1   |         |             |             |       |          |the undiagonalized grid
   |   |          |         |             |             |       |          |
   |   |          |         |             |             |       |          |
   |   |          +         |             |             |       |          |
  ┌+┬──|──────────┬─────────|─────────────|─────────────|───────|──────────|─────────────┐
  │%│┌─+───────┬─┐│┌──┬─────|─────────────|─────────────|───────|────────┬─|────────────┐│
  │ ││┌──┬─┬──┐│~│││[:│┌────|─────────────|─────────────|───────|─────┬─┐│┌+┬─┬────────┐││
  │ │││>:│@│i.││ │││  ││┌──┬|───────┬─────|─────────────|───────|────┐│~│││1│+│┌──┬─┬─┐│││
  │ ││└──┴─┴──┘│ │││  │││[:│+──┬─┬─┐│┌──┬─|─────────────|─┬─────|───┐││ │││ │ ││i.│@│*││││
  │ │└─────────┴─┘││  │││  ││~.│@│;│││[:│┌|───────────┬─+┐│┌─┬─┬+──┐│││ │││ │ │└──┴─┴─┘│││
  │ │             ││  │││  │└──┴─┴─┘││  ││+────────┬─┐│/.│││%│"│1 0││││ ││└─┴─┴────────┘││
  │ │             ││  │││  │        ││  │││┌─┬─┬──┐│<││  ││└─┴─┴───┘│││ ││              ││
  │ │             ││  │││  │        ││  ││││<│@│|.││ ││  ││         │││ ││              ││
  │ │             ││  │││  │        ││  │││└─┴─┴──┘│ ││  ││         │││ ││              ││
  │ │             ││  │││  │        ││  ││└────────┴─┘│  ││         │││ ││              ││
  │ │             ││  │││  │        ││  │└────────────┴──┘│         │││ ││              ││
  │ │             ││  │││  │        │└──┴─────────────────┴─────────┘││ ││              ││
  │ │             ││  ││└──┴────────┴────────────────────────────────┘│ ││              ││
  │ │             ││  │└──────────────────────────────────────────────┴─┘│              ││
  │ │             │└──┴──────────────────────────────────────────────────┴──────────────┘│
  └─┴─────────────┴──────────────────────────────────────────────────────────────────────┘

Try it online!

35: 1+~.@;@([:<@|.`</.%~/~)@(1+i.@*)i.%

thank you, very nice!  i will update it fully later since it will require redoing the explanation...

And 30: %i.~0~.@,@,[:]`|./.[:%/~1+i.@*

that’s clever, use 0 and ~. to avoid the boxing and the increment, i love it

Python 3, 121 bytes
import math
def o(x,y):
 p=q=n=1
 while x*q!=p*y:a=p+q&1;p+=1+a*~-~-(p<2);q+=1-~-a*~-~-(q<2);n+=math.gcd(p,q)<2
 return n

Rust, 244 bytes
I created a simple formula to find the "plain" ordinal of a "plain" zigzag, without the constraints of the puzzle, using triangular numbers formulas:
https://www.mathsisfun.com/algebra/triangular-numbers.html . This was modified with modulo 2 to account for the zig-zags flipping their direction each diagonal row in the puzzle. This is function h()
Then for the main trick of this puzzle: how to 'not count' certain repeating values, like 3/3 vs 1/1, 4/2 vs 2/1, in the zig-zag trail. I ran the 1-200 examples, and noticed the difference between a plain zig-zag triangular counter, and the one the puzzle wishes for, has a pattern. The pattern of "missing" numbers is 5, 12, 13, 14, 23, etc, which resulted in a hit in the OEIS. It is one described by Robert A Stump, at https://oeis.org/A076537 , in order to "deduplicate" numbers like 3/3, 4/2, and 1/1, you can check whether GCD>1 for the x,y of all "previous" ordinals in the zigzag. This is the 'for' loops and g() which is the gcd.
I guess with some builtin gcd it would have been shorter, but I kind of couldn't find one very easily (im kind of new at Rust and Integer confused me), and I like the fact that this one uses straight up integer arithmetic, and no builtins or libraries of any kind.
fn f(x:i64,y:i64)->i64 {
        fn h(x:i64,y:i64)->i64 {let s=x+y;(s*s-3*s+4)/2-1+(s+1)%2*x+s%2*y}
        fn g(x:i64,y:i64)->i64 {if x==0 {y} else {g(y%x,x)}}
        let mut a=h(x,y);
        for i in 1..x+y {for j in 1..y+x {if h(i,j)<h(x,y) && g(i,j)>1 {a-=1;}}}
        a
}

JavaScript (ES6), 86 bytes
Takes input in currying syntax (p)(q).
p=>q=>(g=x=>x*y?x*q-y*p?g(x+d,g[x/=y]=g[x]||++n,y-=d):n:g(x+!~d,y+=!~(d=-d)))(d=n=y=1)

Try it online!

Javascript, 79 bytes
a=(p,q)=>p*q==1?1:1+((p+q)%2?q==1?a(p-1,q):a(p+1,q-1):p==1?a(p,q-1):a(p-1,q+1))

(I am new to code golfing, so this can probably be improved easily)
Explanation
let a = (p, q) => p * q == 1 // If they are both 1
    ? 1
    // Do a recursive call and increment the result by 1
    : 1 + (
        (p + q) % 2 // If on an even-numbered diagonal
        ? q == 1 // If at the beginning of the diagonal
            ? a(p - 1, q) // Go to previous diagonal
            : a(p + 1, q - 1) // Go one back
        : p == 1 // rougly the same
            ? a(p, q - 1)
            : a(p - 1, q + 1)
    )

(3,5) should result in 19 (not 24) since (1,1)==(2,2)==(3,3), (2,4)==(1,2), (4,2)==(2,1) and (2,6)==(1,3). (i.e. (2,2) should result in 1 not 5, etc...)

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Execute a Superb Shuffle™
For the purposes of this question, a deck of cards is formatted in this way:
[
  "AS", "2S", "3S", "4S", "5S", "6S", "7S", "8S", "9S", "10S", "JS", "QS", "KS",
  "AD", "2D", "3D", "4D", "5D", "6D", "7D", "8D", "9D", "10D", "JD", "QD", "KD",
  "AH", "2H", "3H", "4H", "5H", "6H", "7H", "8H", "9H", "10H", "JH", "QH", "KH",
  "AC", "2C", "3C", "4C", "5C", "6C", "7C", "8C", "9C", "10C", "JC", "QC", "KC",
  "J", "J"
]

Cards are always formatted as value, followed by suits. E.g. AS is the Ace of Spades. The two single J's are Jokers. We want to shuffle this deck of cards, but the shuffle must be Superb™.
A Superb Shuffle™ is one in which:

No two cards (except Jokers) of the same suit are adjacent.
No card (except Jokers) is adjacent to one of the same value.
No card (except Jokers) is adjacent to one of an adjacent value (one higher or one lower in this order, A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A. Notice that Ace can not be adjacent to either a 2 or a King).
The Jokers can be in any position.
The definition of a Superb Shuffle™ does not require the cards to be in a different order each time they are shuffled. Which isn't very superb, but it is Superb™.

Because that's Superb™.
An example might be:
[
  "AS", "5D", "9H", "KC", "2D", "6H", "10C", "QS", "3H", "7C", "9S",
  "KD", "4C", "6S", "10D", "AC", "3S", "7D", "JH", "J", "4D", "8H",
  "QC", "AD", "5H", "9C", "JS", "2H", "6C", "8S", "QD", "3C", "5S",
  "9D", "KH", "2S", "6D", "10H", "J", "3D", "7H", "JC", "KS", "4H",
  "8C", "10S", "AH", "5C", "7S", "JD", "2C", "4S", "8D", "QH"
]

The challenge:

Write some code to execute a superb shuffle
Use any language.
The input can be either:

a deck of cards as described above in the same order, as an array or other list structure.
No input (the code generates a deck of cards in that order)

The output must be a full deck of cards in a Superb Shuffle™ as described above.
Attempt to perform your Superb Shuffle™ in the smallest number of bytes.
A link to an online interpreter such as Try It Online is preferred, but optional.

Happy shuffling!

Somewhat related

Can we substitute T instead of 10?

@JoKing You may not. Just like the generating a deck of cards question, the different string lengths are part of the complexity.

Are we allowed to print each card separately like the Charcoal answer does, or do we need to actually return an array/list?

@KevinCruijssen That's fine, as long as it's noticably returning a deck of cards in that format (value then suit).

Reminds me of this one

@Therandomguy Yep, that's one of mine. There might be one or two more in the series, too ;)

Would an array of arrays, each containing 3 or 4 cards be an acceptable output format?

In your penultimate bullet point, did you mean bytes instead of byes?

@paxdiablo Good use of the word "penultimate". Fixed it now.

Can the jokers be next to each other? "Jokers in any position" but "No card is adjacent to one of the same value"

Yes, they can. The Jokers are an exception.

@SamDean Jokers don't have a value or a suit.

@AJFaraday plenty of card games give it a value https://en.wikipedia.org/wiki/Joker_(playing_card)#Use_of_the_Joker_in_card_games

@SamDean I'll just clarify my definition.

Incidentally, this may not be the ideal shuffle for an actual game since if e.g. all aces are sufficiently non-adjacent then as you deal around a circle of players the same one might get them all ;)

Who owns the trademark on Superb Shuffle? Curious to see ™ in an algorithm name. Never seen that before.

Japt, 6 5 4 bytes
Splits the input array into sub-arrays of every 16th element and flattens.
óG c

Try it

Do you need to flatten it?

@Oliver, I'm hoping not; waiting for AJ to confirm.

Ruby, 31 bytes
->x{(0..53).map{|r|x[r*17%54]}}

Try it online!
Explanation:
I'm picking one card, then skipping over the next 16 and start from the first card when I reach the last card of the deck. 17 and 54 are mutually prime, so I'm sure to pick all cards.
The 17th position is guaranteed to be a different suit and the difference in value is at least 2: the 13th (or 15th) card has the same value and a different suit, so by skipping other 4 (or 2), the value is right.

Well done on finding the process every other answer uses ;)

Can you explain how you found the *17%54? Just trial and error or is there some obvious maths that I'm missing?

@Daniel 17 is the required minimum distance between two differently suited cards that are not adjacent numerically (accounting for the two jokers; e.g. 17 steps gets you from the Ace of Clubs to the 3 of Spades); 54 is the number of cards in the deck.

Python 3, 21 bytes
lambda x:(x*17)[::17]

Try it online!
Explanation:
The same idea as my Ruby answer, but even shorter in Python: I use 17 decks, and pick every 17th card.

Java 10, 72 65  bytes
d->{var r=d.clone();for(int i=54;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using i*7%54 on the result-array, instead of i*17%54 on the input-array to save a byte.
Try it online.
Explanation:
d->{              // Method with String-array as both parameter and return-type
  var r=d.clone();//  Result-String, starting as a copy of the input
  for(int i=54;i-->0;
                  //   Loop `i` in the range (54, 0]
    r[            //    Set an item in the result-array at index:
      i*7%54      //     Index `i` multiplied by 7, and then take modulo-54
     ]=d[i]);     //    To the `i`'th item in the input-Deck
  return r;}      //  Return the result-Array

Unfortunately, the result contains numerous cards which are adjacent to cards of the same suit. It starts with AS, 6S, JS, 3D, 8D, KD,.

@AJFaraday TIO was still with 11 instead of 7. Could you check it again. Perhaps I missed something else, but I think it should be correct now (I hope).

That's got it now. Nice work!

JavaScript, 35 bytes
x=>x.map((a,i)=>i%2?a:x[(i+20)%54])

Try it online!
Taking an array of deck as input, and replacing each odd value with another card that is "20 cards" away on the deck.

Aha, when I said "everyone" in my post was incorrect; this is how I went too!

Perl 6, 21 20 18 bytes
Thanks to Brad Gilbert b2gills for -2 bytes
{.[$++*17%$_]xx$_}

Try it online!
Yet another port of G B's answer. Note that, while the global variable $! is not reset between functions, the value doesn't matter, since any order of the output is valid. However, $ is reset.
Explanation:
{                } #Anonymous code block
             xx$_  #Repeat size of inputted array (54) times
 .[         ]      #Get from the inputted array, the value at index
    $++*17%$_         #The incremented variable, multiplied by 17, modded by size of the array

This works just as well with an unnamed state var $ as it does with $! or $/. Also if you used $_ instead of @_ you could start it with .[…] instead of @_[…] saving another byte.

JavaScript, 27
Another one based off of the ruby answer
d=>d.map((_,i)=>d[i*17%54])

Edited in an obvious shortening

05AB1E, 9 7 5 bytes
ā17*è

Port of @GB's Ruby answer, so make sure to upvote him!
-2 bytes by printing each card with a new-line delimiter instead of wrapping it to a result-list
-2 bytes thanks to @Mr.Xcoder
Try it online.
Explanation:
ā        # 1-indexed length range [1 ... length_of_input_list (54)]
 17*     #  `k`: Multiply each index by 17
    è    #  And then replace each item with the 0-indexed `k`'th card of the input-list
         #  (with automatic wrap-around)

ā17*è should save 2 more bytes

T-SQL, 31 bytes
SELECT c FROM t ORDER BY i*7%54

If you don't care about an extra column in the output I can get it down to 29 bytes:
SELECT*FROM t ORDER BY i*7%54

So you can verify my output is "Superb", here is the deck it produces:
 J, 5H,  8S, KH, 3D,  8C, JD, AS, 6H,  9S, AC, 4D, 9C, QD,
2S, 7H, 10S, 2C, 5D, 10C, KD, 3S, 8H,  JS, 3C, 6D, JC,
AH, 4S,  9H, QS, 4C,  7D, QC, 2H, 5S, 10H, KS, 5C, 8D,
KC, 3H,  6S, JH, AD,  6C, 9D,  J, 4H,  7S, QH, 2D, 7C, 10D

(Generated using the new SQL 2017 addition, STRING_AGG):
SELECT STRING_AGG(c,', ')WITHIN GROUP(ORDER BY i*7%54)FROM t

The hard part for me was not the select code, it was populating the input table (which is allowed for SQL per our IO rules).
Because SQL is inherently unordered (it only guarantees a certain order if you include an explicit ORDER BY clause), I had to include that original order as a field  i in the input table t. This also means I can use it to sort, using the same "relatively prime" factor/mod process everyone else is using. I found that i*7%54 worked just as well as i*17%54.
Here are the commands to set up and populate the input table t, based on my solution to this related question:
CREATE TABLE t (i INT IDENTITY(1,1), c VARCHAR(5))

--Insert 52 suited cards
INSERT t(c)
SELECT v.value+s.a as c
FROM STRING_SPLIT('A-2-3-4-5-6-7-8-9-10-J-Q-K','-')v,
     (VALUES('S',1),('D',2),('H',3),('C',4))s(a,b)
ORDER BY s.b

--Insert Jokers
INSERT t(c) SELECT 'J'
INSERT t(c) SELECT 'J'

Would the i not be considered additional input here?

@Shaggy The question says I can get the input deck in the original (listed) order. The only way to guarantee this in SQL is to have the order be an explicit part of the input, because SQL tables have no "default order". So, I view it as a necessary component of the input. But don't worry, SQL is rarely competitive anyway :)

Jelly,  5  4 bytes
s⁴ZẎ

Try it online!
Turns out the way everyone else everyone else except The random guy is doing it saves a byte  :(
Credit to G B for their method.

The way I went...
ṙÐe20

Try it online!
How?
Fix every other card and intersperse it with a rotation of the deck left by 20 places (18 and 22 places also work; furthermore so does either direction of rotation as well as fixing either odd or even cards)
ṙÐe20 - Link: list of the card strings (lists of characters)
   20 - place a literal twenty on the right
 Ðe   - apply to even indices:
ṙ     -   rotate left (by 20)

That is (using T for 10 and rj & bj for the Js):
input: AS 2S 3S 4S 5S 6S 7S 8S 9S TS JS QS KS AD 2D 3D 4D 5D 6D 7D 8D 9D TD JD QD KD AH 2H 3H 4H 5H 6H 7H 8H 9H TH JH QH KH AC 2C 3C 4C 5C 6C 7C 8C 9C TC JC QC KC rj bj
  ṙ20: 8D 9D TD JD QD KD AH 2H 3H 4H 5H 6H 7H 8H 9H TH JH QH KH AC 2C 3C 4C 5C 6C 7C 8C 9C TC JC QC KC rj bj AS 2S 3S 4S 5S 6S 7S 8S 9S TS JS QS KS AD 2D 3D 4D 5D 6D 7D
ṙÐe20: AS 9D 3S JD 5S KD 7S 2H 9S 4H JS 6H KS 8H 2D TH 4D QH 6D AC 8D 3C TD 5C QD 7C AH 9C 3H JC 5H KC 7H bj 9H 2S JH 4S KH 6S 2C 8S 4C TS 6C QS 8C AD TC 3D QC 5D rj 7D

PowerShell 3.0, 30 26 Bytes
$args[(0..53|%{$_*17%54})]

-4 thanks to Mazzy
Old code at 30 bytes
param($d)0..53|%{$d[$_*17%54]}

Another port of G B's method.

26 bytes $args[(0..53|%{$_*17%54})].

@Mazzy I feel like that breaks input specs. Sure they're collected into $args but you're not actually passing one in.

quote: The input can be either:... in the same order, as *an array*. $args is an array.  and you can to use a splatting. for example $a=@("AS", ..., "J"); &{} @a. Try it. :)

in additional, it seems to me that there is no need to count the characters &{ and }. You can to save param($d)0..53|%{$d[$_*17%54]} to a file. and call this file without &{...}

@mazzy Yeah, I've always been a bit unsure of which control parts to keep so just usually defaulted to making it a script block. I'll strip it in the future though.

Charcoal, 8 bytes
Ｅθ§θ×¹⁷κ

Try it online! Link is to verbose version of code. Another port of @GB's Ruby answer. Explanation:
 θ          Input array
Ｅ           Map over elements
       κ    Current index
     ¹⁷     Literal 17
    ×       Multiply
   θ        Input array
  §         Cyclically index
            Implicitly print each result on its own line

Red, 44 bytes
func[a][append/dup a a 16 prin extract a 17]

Try it online!
Another interpetation of G B's code. I append 16 copies of the deck to itself and then extract each 17th card.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
3-inverter with two NOT gates
Introduction
I recently came across an oral exam where the candidates were asked to find a logical circuit than can negate 3 inputs A,B,C using only two NOT gates.
The question also specified that such a circuit is unique up to removal of useless gates and reordering inputs/outputs. The candidates were asked to prove this assertion by writing a piece of code that generates all such circuits.
Challenge
No inputs whatsoever are given.
The program must output all logical circuits using unlimited AND and OR gates but only two NOT gates which take in three inputs which map to three outputs. The outputs should be the negation of each input.
The outputted circuits should not have any redundant/trivial gates (gates that always output the same thing) or unused gates (whose output doesn't influence the outcome).
The program should use no precalculated or cached data.
Output format is left up to the coders.
The winner will be determined by the fastest algorithm. Since input doesn't scale, whoever has the least loops and calculations wins.
Please remember your code must not cache or use any precalculated data.
Example Input and Output
Input:

N/A

Output:
R    = (A & B) | (A & C) | (B & C)
notR = !R
S    = (notR & (A | B | C)) | (A & B & C)
notS = !S

notA = (notR & notS) | (notR & S & (B | C)) | (R & notS & (B & C))
notB = (notR & notS) | (notR & S & (A | C)) | (R & notS & (A & C))
notC = (notR & notS) | (notR & S & (A | B)) | (R & notS & (A & B))

I like your challenge but you should probably add an objective criterion (e.g. fastest-code as mentioned in your post). How would you define "code elegance" to choose a winner? Subjective winning criteria are generally disliked.

Hi, welcome to PPCG! Challenges must always have a clear winning condition tag. Since you've stated the winner is determined by overal simplicity, low runtime, and code-elegance, this is currently a bit vague. May I suggest using the tag [atomic-code-golf] (least amount of operations), where in this case the operations are arithmetic and bitwise ones, including up to 2 NOT, and lowest amount of OR, AND, XOR, etc.? EDIT: @Adyrem beat me to it..

The issue is that due to the uniqueness of the machine, everyone will have the same amount of gates.
I'll think of it a bit more.

I believe I have corrected my question @KevinCruijssen, how do I get it reopened?


text:
Dead Frog Walking
Introduction
Jonny wants to play Frogger. However, he's not very good. In fact, he will only try to move forward, and only after the platforms have moved.
Find out if Jonny's frog manages to reach the end of the path or if it dies on its way.
Challenge
The program will be receiving as input a Frogger grid composed by 0s and 1s, with the following format:

The grid will be of a random width and length, and at least 3x3
1 represents platforms
0 represents water
F represents the starting position of the frog
Every first and last line of the grid will be composed by only 1s, and will not move, and the frog F will be placed at random on the last line
Every intermediate layer will always be moving, and will have a < or > at the end of every line indicating if it moves left or right

Replacing these symbols with your own is allowed, as long as they're all distinct and you specify the replacements in your answer.
The input may be in any compatible format (string with line breaks, array of strings, array of characters, ...).
Challenge Rules

Every turn, all platforms will move one square, based on the direction indicated by the < or > sign
Platforms reappear on the other side of the grid if they get pushed off "screen"
If the frog is on a moving platform, it will move along with it
After that, the frog will jump one square towards the top row. The frog will move every turn.
The frog dies if it jumps in water (0) or it touches the side of the grid along with a moving platform

Your program has to output a truthy value if the frog survives and a falsy value otherwise.
This is code-golf, so the shortest answer in bytes win. Standard loopholes apply.
Examples
Example 1
Input
11111
00111>
00101<
1F111

Output
1
Execution
Turn 1:
11111
10011
01010
1F111

11111
10011
0F010
11111

Turn 2:
11111
11001
F0100
11111

11111
F1001
10100
11111

Turn 3:
11111
1F100
01001
11111

1F111
11100
01001
11111

Example 2
Input
11111
00100<
00100<
1F111

Output
0
Execution
Turn 1:
11111
01000
01000
1F111

11111
01000
0F000
11111

Turn 2:
11111
10000
F0000
11111

11111
F0000
10000
11111

Turn 3:
11111
00001
00001
11111

Will intermediate lines always be moving? Can we take a list of lines as input? If a line is not moving can we assume it ends with a character other than < or > so we can take rectangular arrays as input? By the way, nice challenge!

@dylnan I clarified it in the challenge text. Intermediate layers will always be moving and will always have a < or > at the end.

Does the frog move forward every turn even when there is a 0 in front of it, or will it wait for the next 1? If it can wait, will it go forward on every 1, or can it wait smartly? I.e. with the test case 11111  00001<  00011<  11F11, will it be falsey because it jumps in the water (pastebin of steps); will it be falsey because it moves out of frame (pastebin of steps); or will it be truthy because it waits smartly for the second platform before jumping forward (pastebin of steps)?

@KevinCruijssen it moves every turn, and will happily suicide (as I said, Jonny is not a very good player)

@BgrWorker Ok, that makes the challenge indeed more doable. :) Maybe edit it in the challenge description, that the frog will move forward every turn, even if it would jump into a 0.

@KevinCruijssen I thought it was implicit with rules 4 and 5. I clarified it in rule 4, thanks.

I constantly stalk this forum and this is a really impressive question. I can honestly say that I would have no chance of solving this and I think it's nuts that anyone could even answer it.

Python 2, 168 165 152 145 137 129 bytes
s=input();x=s[-1].find('F');L=len(s[0]);i=k=1
for l in s[-2:0:-1]:d=('<'in l)%-2|1;k*=l[(x-d*i)%L]>'0'>-1<x+d<L;x+=d;i+=1
print k

Try it online!
Input format is a list of strings; characters having meanings as given in the problem statement.
Explanation:
i is the turn number (starting with Turn 1); x is the position of the frogger at the start of that turn.
The row the frogger is about to step onto is the string l (note that via the slicing, these come in bottom to top order). d=('<'in l)%-2|1 yields -1 or 1 depending on the direction the row is moving.
Since this is the ith turn, that row will have shifted from it's original position by i bytes; and so the character the frogger is about to jump onto is l[(x-d*i)%L] where L is the width of the row, so we want that character to be equal to '1'; i.e., >'0'.
In addition, we want to check that the frogger will not be shifted off the edge at the beginning of the next turn; that is the function of expression -1<x+d<L.
These conditions are chained (since '0'>-1 is always True); and if at any time the resulting expression is false, k will become (and then stay) 0.
In any case, we update the frogger's position x+=d and bump the row number; then lather, rinse, repeat.

Python 2, 246 245 244 242 bytes
-3 byte thanks to Mr. Xcoder
-1 byte thanks to Jonathan Frech

m=input()
exec"""for i,r in enumerate(m):
 d=-int(min('1',r[-1]));q=r[d*2]
 if m[i+1:]:r=sum([r[d+1:d-1],[[q,' '][q<'L']]][::d-~d],[])+r[-1:]
 if'F'in r:j=r.index('F');r[j]='L';m[i-1][j]=min('F',m[i-1][j])
 m[i]=r
"""*~-len(m)
print'F'in m[0]

Try it online!
Explanation

d is the direction each layer will move
q is the character that will be wrapped around

[q,' '][q<'L'] will drop the frog off-screen

sum([r[d+1:d-1],[[q,' '][q<'L']]][::d-~d],[])+r[-1:] will remove the last character (the direction), then remove the first character and append it or remove second last and prepend it (based on d), and append the direction back, effectively moving the entire row to the left/right.
if'F'in r:j=r.index('F');r[j]='L';m[i-1][j]=min('F',m[i-1][j]) will make the frog jump forward
min('F',m[i-1][j]) will make the frog fall in the water
The characters comparison (min and <) follow the order ' ' < '0' < '1' < 'F' < 'L'

The input will be a list of list of characters:
' ' - water
'F' - frog
'L' - plataform
'0' - move the layer to the left
'1' - move the layer to the right

if i<len(m)-1 could possibly be if~-len(m)>i.

Java 8, 293 277 bytes
a->{for(int l=a.length-1,x=a[l].indexOf('F'),y=l,i,t=a[0].length()-1,b;y>0;y--){for(i=l;i-->1;a[i]=a[i].endsWith("<")?a[i].substring(1,t+1)+a[i].charAt(0*(x-=b))+"<":a[i].charAt(t)+a[i].substring(0*(x+=b),t)+">")b=i==y?1:0;if(x<0|x>t||a[y].charAt(x)<49)return 0>1;}return 1>0;}

Uses the default characters as specified in the challenge description (01F<>).
Try it online.
Explanation:
a->{                         // Method with String-array parameter & boolean return-type
  for(int l=a.length-1,      //  Amount of rows minus 1
       x=a[l].indexOf('F'),  //  Start x-position of the frog
       y=l,                  //  Start y-position of the frog
       i,                    //  Index-integer
       t=a[0].length()-1,    //  Length of the rows minus 1
       b;                    //  Temp integer
       y>0;                  //  Loop as long as the frog hasn't reached the other side
       y--){                 //    Jump forward once after every turn
    for(i=l;l-->1;           //   Inner loop over all the moving rows
        ;a[i]=               //     After every iteration: Change the moving row to:
         a[i].endsWith("<")? //      If the current platform moves to the left:
          a[i].substring(1,t+1)
                             //       Last part of the platform
                             //        i.e. "00101<" → "0101"
          +a[i].charAt(0     //       Appended with the first character
                             //        i.e. "00101<" → '0'
            *(x-=b))         //       We are moving left, so subtract `b` from `x`
          +"<"               //       And append the direction "<" again
                             //        so "00101<" becomes "01010<"
         :                   //      Else (the platform moves to the right):
          a[i].charAt(t)     //       Take the last character
                             //        i.e. "00111>" → '1'
          +a[i].substring(0  //       And append the first part of the platform
                             //        i.e. "00111>" → "0011"
            *(x+=b),t)       //       We are moving right, so add `b` to `x`
          +">")              //       And append the direction "<" again
                             //        so "00111>" becomes "10011>"
      b=i==y?                //    If the frog is on the current row:
         1                   //     Set `b` to 1
        :                    //    Else:
         0;                  //     Set `b` to 0
    if(x<0|x>t               //   If the Frog is out of bounds
       ||a[y].charAt(x)<49)  //   Or jumped into the water
      return 0>1;}           //    Return false
  return 1>0;}               //  If the loop ended the frog made it to the other side,
                             //  so return true


text:
Find the Squarish Root
Write code that when given a positive number \$x\$ as input, outputs the largest positive divisor of \$x\$ less than or equal to the square root of \$x\$.
In other words find the largest \$n > 0\$ such that
\$\exists m\geq n:m\cdot n=x\$
(Exists \$m\$ greater than or equal to \$n\$ such that \$m\$ times \$n\$ is \$x\$)

For example if the input were \$12\$ the divisors are \$1\$, \$2\$, \$3\$, \$4\$, \$6\$, and \$12\$.  \$1\$, \$2\$ and \$3\$ all multiply by larger numbers to get \$12\$, but \$3\$ is the largest so we return \$3\$.

This is code-golf so answers will be scored in bytes with fewer bytes being considered a better score.
Test Cases
(1,1)
(2,1)
(3,1)
(4,2)
(5,1)
(6,2)
(7,1)
(8,2)
(9,3)
(10,2)
(11,1)
(12,3)
(13,1)
(14,2)
(15,3)
(16,4)
(17,1)
(18,3)
(19,1)
(20,4)
(21,3)
(22,2)
(23,1)
(24,4)
(25,5)
(26,2)
(27,3)
(28,4)
(29,1)
(30,5)
(31,1)
(32,4)
(33,3)
(34,2)
(35,5)
(36,6)
(37,1)
(38,2)
(39,3)
(40,5)
(41,1)
(42,6)
(43,1)
(44,4)
(45,5)
(46,2)
(47,1)
(48,6)
(49,7)
(50,5)

OEIS A033676

I don't see how closing popular questions as dupes of older inactive ones help the site...? If you notice it early, sure, go ahead and hammer it. If it has twice the number of answers and more upvotes than the old one. Keep it, and if anything, close the other one...

@StewieGriffin A problem with "popular questions" is that they're on HNQ. Which is probably not a very good thing. / I don't see how it harms the site either, you can just move the answers to the old one.

The HNQ might attract new users, and that's a good thing (IMO).

Come on, this isn't a dupe. The linked question requires both numbers, this one requires one

@qwr But the core idea is the same. The difference is very small. Method in each challenge can be used for another.

... and is still competitive. For example the Python2/3 solutions here.

@user202729 it is not the same. For example Peter Cordes's solution below would have to be modified

This gotta be an OEIS somehow, right?

@htmlcoderexe There is! It is at the bottom of the question.

@CatWizard absolutely missed that!

@CatWizard, I don't quite understand why my question is being closed as the duplicate when you're claiming this one is different and mine predates yours by over 5 years.  I honestly don't give a crap about the condition of my forgotten question, but I'm concerned about a community that endorses that kind of sabotage.  I'll happily take this to meta, but I'm not sure how to get there.

@Hand-E-Food I don't claim this one is different.  In fact I do believe that the two have the same content.  My reasons for the closure of your question are the same as those in the comment at the top of the thread, this question has more answers.  The meta is here if you would like to ask there.  You may also have interest in this.

Thanks for those links!  I appreciate getting a better understanding of the policy.

Python3, 49 47 bytes
def f(x):
 l=x**.5//1
 while x%l:l-=1
 return l

Explanation

l=x**.5//1 → Assign l the largest integer less than equal to the square root of x
while x%l:l-=1 → While l does not evenly divide x, decrement l.

Edits

Mention Python3, not Python2
Use ...//1 to save two bytes.  (Decimals are okay!  Thanks @Rod)

Welcome to PPCG, nice first answer! You can save few bytes by using input/print instead def/return, you can also replace int(...) with ...//1 to save more bytes as you can see here

@Rod not //1, as I meant have said Python3. (Unless decimals are okay for the output, which I didn't think so.)  But for Python2, thanks!

@hunteke Decimal output is fine, I don't see any reason it ought not be.

Would it be shorter with "For" instead of "While", so you can assign values in the conditional, possibly avoiding defining "l"?

MATL, 7 bytes
Z\tn2/)

Try it online!
For this explanation, we will use '12' as a sample input. Explanation:
Z\      % Divisors.
        % Stack:
        %   [1 2 3 4 6 12]
  t     % Duplicate.
        % Stack:
        %   [1 2 3 4 6 12]
        %   [1 2 3 4 6 12]
   n    % Number of elements.
        % Stack:
        %   6
        %   [1 2 3 4 6 12]
    2/  % Divide by 2
        % Stack:
        %   3
        %   [1 2 3 4 6 12]
      ) % Index (grab the 3rd element)
        % 3

This works because of a lot of lucky coincidences.

MATL uses 1 indexing
If we index with a non-integer (this will happen for any perfect square input), then <n>) will index \$\lceil n \rceil\$

......well I've been soundly trounced!

It had to be you who answered this in MATL :-)

BTW I think you can shorten to Z\J2/) (J2/ or equivalently .5j stands for end/2 when used as an index)

It might be worth explaining the behavior when applied to a number with an odd number of divisors, since "Index" with a non-integer value isn't obvious.

@KamilDrakari How is that?

@DJMcMayhem Pretty good, though I'm not sure 2 counts as "a lot" :P

C (gcc) -lm, 35 bytes
i;f(n){for(i=sqrt(n);n%i;i--);n=i;}

Try it online!

BTW, this only works because of GCC's recognition of sqrt as a built-in function.  With -fno-builtin-sqrt, gcc assumes int sqrt(int), and doesn't pass a double.  On x86-64, double is passed in a different register than an integer.  On 32-bit, a double would take 2 slots on the stack, so you'd also be passing garbage (or a subnormal with the integer as the bottom of the mantissa, if the upper 32bits were zero).  This also breaks unless you're making a debug build because it relies on gcc's default un-optimized code-gen of evaluating expressions in the return-value register.

@PeterCordes Yes, it's code golf, not a medical device :-)

Well I'm not a fan of the fake-return hack.  That's not even C anymore, it's just an implementation detail with one compiler setting which happens to be the default.  (It's really stretching the "has to work with at least one implementation" rule.)  The sqrt() issue is different: I was curious how that managed to work, because the caller has to somehow know to convert int to double.  I posted the answer to that as a comment in case anyone else was curious.  Effectively gcc has sqrt (including prototype) as a built-in, otherwise this would fail for reasons we sometimes see in SO asm  Qs

i;f(n){for(i=0;++i<n/i||n%i;);} is 31B, and works with gcc -O on x86-64 (costing 2 or 3 more bytes for the command line option.)  Using || instead of | causes gcc to leave the n/i result from idiv in EAX, the return-value register (https://godbolt.org/g/RJYeui).  The undefined-behaviour from ++i without a sequence point happens to work.  (The asm produced is basically the same as my x86 machine code answer.)  With -O0, gcc always seems to leave i in EAX, but maybe we can use that...

Anyway, if you like non-C gcc implementation-details answers, maybe you'll like this x86-64 gcc answer that happens to work because of the asm produced by the compiler for clearly undefined behaviour: Try it online! (31+2 bytes)

05AB1E, 5 bytes
Ñ2äнθ

Try it online!
or as a Test suite
Explanation
Ñ        # push the list of divisors
 2ä      # split it into 2 parts
   н     # take the first haft
    θ    # take the last element of that

APL (Dyalog Unicode), 16 14 12 bytes
I'm glad I was able to write some answer in APL since I only just learned it. Many, many thanks to Adám for help with golfing. Golfing suggestions very much welcome. Try it online!
To learn more about APL, take a look at The APL Orchard.
EDIT: -2 bytes to fixing a problem with my code. Thanks to H.PWiz for pointing out that problem. -2 bytes from shortening everything again.
⌈/{⍳⌊⍵*÷2}∨⊢

Ungolfing
⌈/{⍳⌊⍵*÷2}∨⊢
          ∨   GCD of the following...
           ⊢    The right argument, our input.
  {⍳⌊⍵*÷2}
     ⍵            Our input.
      *÷2         To the power of 1/2, i.e. square root.
    ⌊             Floor.
   ⍳              Indices up to floor(sqrt(input)).
                In total, range from 1 to floor(sqrt(input)).
⌈/            The maximum of the GCDs of our input with the above range.

Why do you strikethrough in reverse order? ... I often see ---16--- ---14--- 12, not 12 ---14--- ---16---.

@user202729 Frankly, it's been a while, and I quite forgot the order of strikethrough. Will fix it shortly.

Actually it's not a problem, the leaderboard snippet supports both.

Husk, 4 bytes
→←½Ḋ

Try it online!
Explanation
→←½Ḋ
   Ḋ      Divisors of (implicit) input.
  ½       Bisect.
→←        Take the last element of the first half.

R, 45 33 bytes
function(x,y=1:x^.5)max(y[!x%%y])

Try it online!
Original:
function(x,y=x/1:x^.5)max(which(y==floor(y)))

Try it online!

33 bytes

x86 32-bit (IA32) machine code: 18 16 bytes
changelog: handle the n=1 test case correctly, save 2 bytes, and return in EAX.
Count up until n/i <= i (i.e. when we reach the sqrt), and use the first exact divisor after that.
A 64-bit version of this is callable from C with the x86-64 System V calling convention, as
int squarish_root_countup(int edi).
nasm -felf32 -l/dev/stdout  squarish-root.asm:
58                         DEF(squarish_root_countup)
59                             ; input: n in EDI
60                             ; output: EAX
61                             ; clobbers: eax,ecx,edx
62                         .start:
63 00000025 31C9               xor    ecx, ecx
64                         .loop:                    ; do{
65
66 00000027 41                 inc    ecx                ; ++i
67 00000028 89F8               mov    eax, edi
68 0000002A 99                 cdq
69 0000002B F7F9               idiv   ecx                ; edx=n%i    eax=n/i
70
71 0000002D 39C1               cmp    ecx, eax
72 0000002F 7CF6               jl     .loop          ; }while(i < n/i
73                                                   ;          || n%i != 0);  // checked below
74                             ; falls through for i >= sqrt(n)
75                             ; so quotient <= sqrt(n) if we get here
76
77                                                   ; test edx,edx / jnz  .loop
78 00000031 4A                 dec    edx            ; edx-1 is negative only if edx was zero to start with
79 00000032 7DF3               jge   .loop           ; }while(n%i >= 1);
80                             ; falls through for exact divisors
81
82                             ; return value = quotient in EAX
83
84 00000034 C3                 ret

           0x10 bytes = 16 bytes.

85 00000035 10             .size: db $ - .start

Try it online! with an asm caller that uses the first byte of argv[1] as an integer directly, and uses the result as process exit status.
$ asm-link -m32 -Gd squarish-root.asm &&
for i in {0..2}{{0..9},{a..f}};do
    printf "%d   " "0x$i"; ./squarish-root "$(printf '%b' '\x'$i)"; echo $?;
done

0   0  # bash: warning: command substitution: ignored null byte in input
1   1
2   1
3   1
4   2
5   1
6   2
7   1
8   2
9   3
10   0       # this is a testing glitch: bash ate the newline so we got an empty string.  Actual result is 2 for n=10
11   1
12   3
13   1
14   2
15   3
16   4
   ...

Are you sure n=1 isn't just 1? It is listed as a test case and it is a divisor ≤ √1 = 1.

Your answer should work for 1.  If it doesn't work with your algorithm then you are going to have to hard code it.

@qwr:  updated with a shorter version that works for all inputs.

Japt -h, 8 6 bytes
â f§U¬

Try it
2 bytes saved thanks to Oliver

Explanation
           :Implicit input of integer U
â          :Divisors of U
  f        :Filter
   §       :  Less than or equal to
    U¬     :  Square root of U
           :Implicitly get the last element in the array and output it

Don't flags still cost bytes?

@mbomb007 No. Each instance of a flag is considered a new language entry.

Never mind. I guess I hadn't seen that meta post yet.

JavaScript ES7, 33 31 bytes
n=>(g=x=>n%x?g(x-1):x)(n**.5|0)

Try it online

Jelly, 5 bytes
ọⱮ½TṪ

Try it online!

Snowman, 38 bytes
((}1vn2nD`#nPnF|:|NdE|;:,#NMo*|,;bW*))

Try it online!
((
  }        activate variables b, e, and g
  1vn2nD`  e=1/2
  #        retrieve the input into b
  nP       set b=b^e, which is sqrt(input)
  nF       floor the square root
  |        move b into g so there's space for a while loop
  :        body of the loop
    |NdE|  decrement the value in g
  ;:       loop condition
    ,#     assign b=input, e=current value
    NMo    store the modulo in g
    *|     discard the input value and place the modulo in the condition slot
    ,      put the current value back into g
  ;bW      continue looping while the modulo is nonzero
  *        return the result
))

dc, 24
?dsnv1+[1-dlnr%0<m]dsmxp

Try it online!
Explanation:
?                         # read input
 d                        # duplicate
  sn                      # store copy 1 in register n
    v                     # take the square root of copy 2
     1+                   # add 1
       [          ]       # define macro to:
        1-                #   subtract 1
          d               #   duplicate
           ln             #   load from register n
             r            #   reverse top 2 stack members
              %           #   calculate modulo
               0<m        #   if not 0, recursively call macro m again
                   d      # duplicate macro
                    sm    # store copy 1 in register m
                      x   # execute copy 2
                       p  # print final value

J, 24 19 bytes
-5 bytes thanks to Sherlock's GCD idea
([:>./+.)1+i.@<.@%:

Try it online!
original answer
([:{:]#~0=]|[)1+i.@<.@%:

Try it online!
parsed
┌───────────────────────────────┬──────────────────────┐
│┌──┬──┬───────────────────────┐│┌─┬─┬────────────────┐│
││[:│{:│┌─┬─────┬─────────────┐│││1│+│┌─────────┬─┬──┐││
││  │  ││]│┌─┬─┐│┌─┬─┬───────┐││││ │ ││┌──┬─┬──┐│@│%:│││
││  │  ││ ││#│~│││0│=│┌─┬─┬─┐│││││ │ │││i.│@│<.││ │  │││
││  │  ││ │└─┴─┘││ │ ││]│|│[││││││ │ ││└──┴─┴──┘│ │  │││
││  │  ││ │     ││ │ │└─┴─┴─┘│││││ │ │└─────────┴─┴──┘││
││  │  ││ │     │└─┴─┴───────┘│││└─┴─┴────────────────┘│
││  │  │└─┴─────┴─────────────┘││                      │
│└──┴──┴───────────────────────┘│                      │
└───────────────────────────────┴──────────────────────┘

explanation

1 + i.@<.@%: gives the range 1 .. floor(sqrt).
the entire verb (A) B forms a hook, with the above range passed as the right arg ] to A and the original number passed as its left arg [.  Thus...
] | [ gives the remainer of each item in the range divided into the original arg.
and 0 = ] | [ gives the divisors with no remainder.
] #~ ... then filters the range, leaving only those.
and {: gives the last item in the list, ie, the largest one.

Python 2, 41 bytes
n=k=input()
while(k*k>n)+n%k:k-=1
print k

Try it online!

Vyxal G, 5 bytes
K'?√≤

Try it online, or see a flagless MATL port.
Explanation:
K      # Factors
 '     # Filter by:
   √   #   Square root of
  ?    #   The input
    ≤  #   Is less than or equal to the input
       # Get the greatest item with the G flag

Flagless 5 by porting MATL

Jelly, 5 bytes
½ḍƇµṪ

Try it online!

Haskell, 36 bytes
f x=[z|y<-[1..],z<-[1..y],y*z==x]!!0

Try it online!
Well this is my answer to this challenge.
This uses a particular list comprehension to find the answer.
In our list comprehension we pick \$y\$ from the infinite list [1..] that is the positive integers, and we pick \$z\$ from the list [1..y].  This means that \$(y,z)\$ is all the ordered pairs such that \$y \geq z\$.
We then select only those pairs such that \$y\cdot z=x\$, meaning that we make the list of all pairs of numbers that multiply to \$x\$.  Now since our comprehension is based first on \$y\$ and then \$z\$ this means that our pairs are in ascending order of \$y\$, or more usefully in descending order of \$z\$.
So to get the largest \$z\$ we take the \$z\$ belonging to the first element.  This is our result.

QBasic (4.5), 52 bytes
INPUT x
FOR i=1TO sqr(x)
if x/i=x\i then m=i
next
?m

Forth (gforth), 53 bytes
The shortest way seems to be using the floating point stack and fsqrt, the shortest I could get without it was 62 bytes using /mod and checking if the quotient was greater than the divisor.
: f dup s>f fsqrt f>s 1+ begin 1- 2dup mod 0= until ;

Try it online!
Explanation

Calculate the square root
Starting at the square root, decrement by 1 until we find a factor of the original number

Code Explanation
: f                \ Start a word definition
dup                \ duplicate the input
s>f fsqrt          \ move the number to the float stack and get the square root
f>s                \ truncate result and move to integer stack
1+                 \ add 1 to the square root
begin              \ start indefinite loop
  1- 2dup          \ decrement divisor and duplicate input and divisor
  mod              \ calculate n % divisor
0= until           \ if result equals 0 (no remainder) end the loop
;                  \ end the word definition

F#, 55 49 bytes
let f x=Seq.findBack(fun i->x%i=0.0){1.0..x**0.5}

Try it online!
Seq.findBack: Returns the last element for which the given function returns True. The function in this case checks to see if a number is a factor of the value.

Brain-Flak, 144 bytes
{({}{}<<>({}<>)<>([({})()]<>({}(<>)())){(<{}({}[()]{}<({}())>)>)}{}((({}<>)<>(({})))[({}[{}])])>[({<({}[()])><>({})<>}{}<><{}>)])}{}{}<>{}({}<>)

Try it online!
I'm not really sure this answer is very good.  I feel like there may be a nice way to solve this task however I'm just not clever enough.
Explanation
I tried to do an exploded view of the answer but there are so many moving parts it was not very enlightening, so here is an explanation of what the code does.
The first important bit is this
({}<>)<>([({})()]<>({}(<>)())){(<{}({}[()]{}<({}())>)>)}{}

This takes the two numbers on top of the stack and if they are unequal increments the second one, if they are equal it increments the first one and replaces the second one with zero.  If we repeat this code a bunch we will get all the pairs \$(x,y)\$ such that \$x \geq y\$.
The next part is multiplication, taken with modification from the wiki.  This multiplication is special because it preserves the existing values without destroying them.  It goes like:
((({}<>)<>(({})))[({}[{}])])({<({}[()])><>({})<>}{}<><{}>)

So we are multiplying all these ordered pairs.  For each result we check if it is equal to the input.  If so we terminate and return the smaller item in the pair.

Jelly, 6 bytes
ÆDŒHḢṪ

Try it online!

Perl 5 -p, 26 bytes
$\=0|sqrt;$\--while$_%$\}{

Try it online!

Rust, 71 70 bytes
fn f(x:u64)->u64{let mut l=(x as f64).sqrt()as u64;while x%l>0{l-=1}l}

Pre-uglified version
fn f(x: u64) -> u64 {                    // function takes u64, gives u64
  let mut l = (x as f64).sqrt() as u64;  // l takes integer'ed root value
  while x % l > 0 {                      // loop while l leaves remainder
    l -= 1                               // decrement
  }
  l                                      // return the found value
}

Edits

Save a byte with > 0 over != 0.  (Thanks to @CatWizard)

Can != be replaced with >?

Good call!  Yes.

Japt, 8 bytes
â w æ§Uq

Try it online!

Triangularity, 49 bytes
....)....
...@_)...
..IEdF)..
.2)1/)IE.
^>{m.....

Try it online!

Pyret, 93 bytes
{(z):rec f={(i,x):if num-modulo(i, x) == 0:x else:f(i,x - 1)end}
f(z,num-floor(num-sqrt(z)))}

You can try this online by copying it into the online Pyret editor!
The above evaluates to an anonymous function. When it is applied to an integer, it returns a result according to the specification.

Actually, 7 bytes
Based on my APL answer here. Golfing suggestions welcome! Try it online!
;√LR♀gM

Ungolfing
;√LR♀gM  Implicit input n
;        Duplicate n
 √       sqrt(n)
  L      floor(sqrt(n))
   R     1..floor(sqrt(n))
    ♀g   gcd(n, foreach(1..floor(sqrt(n)))
      M  The maximum of the GCDs.
         Return this maximum.

A port of this Mathematica answer.
Jelly, 11 bytes
½ðḞ³÷Ċ³÷µÐL

Try it online!
This (11 bytes) also works, and don't depend on ³:
½Ḟ÷@Ċ÷@ʋƬµṪ

Unfortunately ½Ḟ÷@Ċ÷@ʋÐL (10 bytes) doesn't work. And apparently Ƭ and ÐĿ is not exactly the same (when the link is dyadic)

Method: (let \$n\$ be the input)

Start with an upper bound \$i = \sqrt n\$ of the answer \$a\$.
At each step:

If \$i\$ is not an integer, then the upper bound can be made \$\lfloor i\rfloor\$ (because the result must be an integer)
If \$n\over i\$ is not an integer, then \$a \le i
\Rightarrow \frac n a \ge \frac n i
\Rightarrow \frac n a \ge \lceil \frac n i \rceil
\Rightarrow a \le n \div \lceil \frac n i \rceil
\$.

So we repeatedly replace \$i\$ with \$n \div \lceil \frac n {\lfloor i\rfloor} \rceil\$ until it's fixed.

Java 8, 65 54 bytes
n->{int r=(int)Math.sqrt(n);for(;n%r>0;r--);return r;}

Port of @hunteke's Python 3 answer.
Try it online.

Old 65 bytes answer:
n->{int r=1,i=n;for(;i-->1;)r=n%i<1&n/i<=i&n/i>r?n/i:r;return r;}

Try it online.
Explanation:
n->{                // Method with integer as both parameter and return-type
  int r=1,          //  Result-integer, starting at 1
  i=n;for(;i-->1;)  //  Loop `i` in the range (n, 1]
    r=n%i<1         //   If `n` is divisible by `i`,
      &n/i<=i       //   and if `n` divided by `i` is smaller than or equal to `i` itself,
      &n/i>r?       //   and if `n` divided by `i` is larger than the current `r`
       n/i          //    Set `n` divided by `i` as the new result `r`
      :             //   Else:
       r;           //    Leave result `r` unchanged
  return r;}        //  Return the result `r`

Pari/GP, 25 bytes
n->(d=divisors(n))[#d\/2]

Try it online!

Ruby, 35 bytes
->n,i=n{i-=1until(i*i<=n&&n%i<1);i}

Try it online!

Julia 0.6, 26 bytes
x->(r=1:√x)[x%r.<1][end]

Try it online!
r=1:√x generates the list of integers upto (and possibly including) √x. From those, select values for which x%r is 0 i.e. values which divide x. From those, select the last value.

Rust, 52 bytes
|x|(1..=(x as f64).sqrt()as _).rev().find(|l|x%l==0)

Try it online!

Thunno 2 ht, 3 bytes
F2Ẇ

Try it online!
Explanation
       # Implicit input

F      # All factors of the input
       #   12 -> [1,2,3,4,6,12]
       #   15 -> [1,3,5,15]
       #   25 -> [1,5,25]

 2Ẇ    # Split into 2 (left-bias)
       #   12 -> [[1,2,3],[4,6,12]]
       #   15 -> [[1,3],[5,15]]
       #   25 -> [[1,5],[25]]

   h   # Take the first item
       #   12 -> [1,2,3]
       #   15 -> [1,3]
       #   25 -> [1,5]

    t  # Take the last item
       #   12 -> 3
       #   15 -> 3
       #   25 -> 5

       # Implicit output


text:
Recover the power from the prime power
It seems that many people would like to have this, so it's now a sequel to this challenge!
Definition: a prime power is a natural number that can be expressed in the form pn where p is a prime and n is a natural number.
Task: Given a prime power pn > 1, return the power n.
Testcases:
input output
9     2
16    4
343   3
2687  1
59049 10

Scoring: This is code-golf. Shortest answer in bytes wins.

Note: This challenge might be trivial in some golfing languages, but it's not so trivial for some mainstream languages, as well as the language of June 2018, QBasic.

Can we output True instead of 1? Alternatively, float instead of ints?

@JoKing yes, yes.

@EriktheOutgolfer Challenge accepted :D

Python 2, 37 bytes
f=lambda n,i=2:i/n or(n%i<1)+f(n,i+1)

Try it online!
Counts factors. Apparently I wrote the same golf in 2015.
Narrowly beats out the non-recursive
Python 2, 38 bytes
lambda n:sum(n%i<1for i in range(1,n))

Try it online!

05AB1E, 2 bytes
Òg

Try it online!

Welcome to PPCG!

Welcome indeed! For anyone reading this: Ò: Push list of prime factors (with duplicates) and g: Push length.

Python 3, 49 bytes
f=lambda n,x=2:n%x and f(n,x+1)or n/x<2or-~f(n/x)

Try it online!
Outputs True instead of 1 (as allowed by OP). Recursive function that repeatedly finds the lowest factor and then calls the function again with the next lowest power until it reaches 1. This is an extension of my answer to the previous question.

Bash + GNU utilities, 22

2 bytes saved thanks to @H.PWiz and @Cowsquack

factor|tr -cd \ |wc -c

Try it online!

Does factor|sed s/\ //|wc -w work?

What about factor|tr -cd \ |wc -c?

Turns out awk is indeed shorter, factor|awk \$0=NF-1

Stax, \$\require{cancel}\xcancel 4 3\$ bytes
|f%

Run and debug it
Length of prime factorization.

Ahh.. you're breaking the crossed out 4 is still regular 4 ;( meme. ;p (It was getting old anyway though.. So well done I guess)

$\text{Yay, MathJax abuse!}$ But remember to put the cross before the actual bytecount otherwiae the leaderboard snippet may not be able to recognize it.

R 22 bytes
Power n is the number of multiples of p in p^n when p is prime:
sum(!(b<-scan())%%2:b)

Try it online!

Nibbles 5 bytes
,|`,$~^%@

This is 9 nibbles each of which is encoded in a half byte in the binary form. I think this is the shortest solution that doesn't use built in factoring.
Translation:
,      length
 |     filter
  `,$  0..input
  ~    not \x->
   ^   pow (so that 0 which would have been 0 from the mod isn't)
    %  mod
     @ input
     implicit $ (x)
    implicit $ (x)

It works by just counting the number of numbers the input divides evenly
You could run it passing in a list of numbers to process in stdin or as a command line arg. Nibbles isn't on TIO.run yet...

dc, 50 41 bytes
1si[dli1+dsi%0<X]dsXx[dli/dli<Y]sYdli<Yzp

Try it online!
Takes input from the top of the stack (in TIO, put the input in the header to load it onto the stack before execution). Outputs to stdout.
Explanation
Registers used:
i: the current trial divisor, while X is running. Later, the divisor we've found.
X: the macro dli1+dsi%0<X, which has the effect "increment i, then check the modulus with the value on the stack (which will be the original input). If it's not zero, repeat".
Y: the macro dli/dli<Y, which has the effect "Add to the stack a copy of the current top of the stack, divided by i. Repeat until i is reached."
Full program:
1si                 Initialize i
[dli1+dsi%0<X]dsXx  Define and run X
[dli/dli<Y]sY       Define Y
dli<Y               Run Y, but only if needed (if the input wasn't just i)
z                   The stack is i^n, i^(n-1), ... ,i, so print the stack depth

I found a much better solution! Editing now...

Pyth, 2
Count prime factors:
lP

Online test.

face, 86 bytes
(%d@)\$*,c'$,io>Av"[""mN*c?*m1*mp*m%*s1"$pN1p:~+p1p%%Np?%~:=/NNp+?1?-%N1?%=p%'$i?w1'%>

Hooray, longer than Java!
Try it online!
I am particularly fond of the trick of using the return value of sscanf.
Normally the return value would be discarded,
but here it will always be 1,
because we're always reading a single number as input.
We can take advantage of this
by assigning its return value to the variable 1,
saving the 2 bytes that would otherwise be required
to assign 1 to 1 explicitly.
(%d@)

\$*,c'$,io>  ( setup - assign $ to "%d", * to a number, o to stdout )
Av"[""mN*    ( set " to input and allocate space for N for int conversion )
c?*          ( calloc ?, starting it at zero - this will be the output )
m1*          ( allocate variable "1", which gets the value 1 eventually )
mp*m%*       ( p is the prime, % will be used to store N mod p )

s1"$pN       ( scan " into N with $ as format; also assigns 1 to 1 )

1p:~         ( begin loop, starting p at 1 )
  +p1p       ( increment p )
  %%Np       ( set % to N mod p )
?%~          ( repeat if the result is nonzero, so that we reach the factor )

:=           ( another loop to repeatedly divide N by p )
  /NNp       ( divide N by p in-place )
  +?1?       ( increment the counter )
  -%N1       ( reuse % as a temp variable to store N-1 )
?%=          ( repeat while N-1 is not 0 -- i.e. break when N = 1 )

p%'$i?       ( sprintf ? into ', reusing the input format string )
w1'%>        ( write to stdout )

Attache and Wolfram Language (Mathematica) polyglot, 10 bytes
PrimeOmega

Try Attache online! Try Mathematica online!
Simply a builtin for computing the number of prime factors N has.
Explanation
Since N = pk, Ω(N) = Ω(pk) = k, the desired result.

Whitespace, 141 bytes
[S S S N
_Push_0][S N
S _Duplicate_0][T   N
T   T   _Read_STDIN_as_number][T    T   T   _Retrieve][S S S T  N
_Push_1][N
S S N
_Create_Label_LOOP_1][S S S T   N
_Push_1][T  S S S _Add][S N
S _Duplicate][S T   S S T   S N
_Copy_2nd_input][S N
T   _Swap_top_two][T    S T T   _Modulo][N
T   S S N
_If_0_Jump_to_Label_BREAK_1][N
S N
N
_Jump_to_Label_LOOP_1][N
S S S N
_Create_Label_BREAK_1][S S S N
_Push_0][S T    S S T   S N
_Copy_2nd_input][N
S S T   N
_Create_Label_LOOP_2][S N
S _Duplicate_input][S S S T N
_Push_1][T  S S T   _Subtract][N
T   S S S N
_If_0_Jump_to_Label_BREAK_2][S N
T   _Swap_top_two][S S S T  N
_Push_1][T  S S S _Add][S N
T   _Swap_top_two][S T  S S T   S N
Copy_2nd_factor][T  S T S _Integer_divide][N
S N
T   N
_Jump_to_Label_LOOP_2][N
S S S S N
_Create_Label_BREAK_2][S N
N
_Discard_top][T N
S T _Print_as_number]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Try it online (with raw spaces, tabs and new-lines only).
Explanation in pseudo-code:
Integer n = STDIN as input
Integer f = 1
Start LOOP_1:
  f = f + 1
  if(n modulo-f == 0)
    Call function BREAK_1
  Go to next iteration of LOOP_1

function BREAK_1:
  Integer r = 0
  Start LOOP_2:
    if(n == 1)
      Call function BREAK_2
    r = r + 1
    n = n integer-divided by f
    Go to next iteration of LOOP_2

function BREAK_2:
  Print r as number to STDOUT
  Program stops with an error: Exit not defined

Example run: input = 9
Command    Explanation                    Stack           Heap    STDIN   STDOUT   STDERR

SSSN       Push 0                         [0]
SNS        Duplicate top (0)              [0,0]
TNTT       Read STDIN as number           [0]             {0:9}   9
TTT        Retrieve                       [9]             {0:9}
SSSTN      Push 1                         [9,1]           {0:9}
NSSN       Create Label_LOOP_1            [9,1]           {0:9}
 SSSTN     Push 1                         [9,1,1]         {0:9}
 TSSS      Add top two (1+1)              [9,2]           {0:9}
 SNS       Duplicate top (2)              [9,2,2]         {0:9}
 STSSTSN   Copy 2nd from top              [9,2,2,9]       {0:9}
 SNT       Swap top two                   [9,2,9,2]       {0:9}
 TSTT      Modulo top two (9%2)           [9,2,1]         {0:9}
 NTSSN     If 0: Jump to Label_BREAK_1    [9,2]           {0:9}
 NSNN      Jump to Label_LOOP_1           [9,2]           {0:9}

 SSSTN     Push 1                         [9,2,1]         {0:9}
 TSSS      Add top two (2+1)              [9,3]           {0:9}
 SNS       Duplicate top (3)              [9,3,3]         {0:9}
 STSSTSN   Copy 2nd                       [9,3,3,9]       {0:9}
 SNT       Swap top two                   [9,3,9,3]       {0:9}
 TSTT      Modulo top two (9%3)           [9,3,0]         {0:9}
 NTSSN     If 0: Jump to Label_BREAK_1    [9,3]           {0:9}
NSSSN      Create Label_BREAK_1           [9,3]           {0:9}
SSSN       Push 0                         [9,3,0]         {0:9}
STSSTSN    Copy 2nd from top              [9,3,0,9]       {0:9}
NSSTN      Create Label_LOOP_2            [9,3,0,9]       {0:9}
 SNS       Duplicate top (9)              [9,3,0,9,9]     {0:9}
 SSSTN     Push 1                         [9,3,0,9,9,1]   {0:9}
 TSST      Subtract top two (9-1)         [9,3,0,9,8]     {0:9}
 NTSSSN    If 0: Jump to Label_BREAK_2    [9,3,0,9]       {0:9}
 SNT       Swap top two                   [9,3,9,0]       {0:9}
 SSSTN     Push 1                         [9,3,9,0,1]     {0:9}
 TSSS      Add top two (0+1)              [9,3,9,1]       {0:9}
 SNT       Swap top two                   [9,3,1,9]       {0:9}
 STSSTSN   Copy 2nd from top              [9,3,1,9,3]     {0:9}
 TSTS      Integer-divide top two (9/3)   [9,3,1,3]       {0:9}
 NSNTN     Jump to Label_LOOP_2           [9,3,1,3]       {0:9}

 SNS       Duplicate top (3)              [9,3,1,3,3]     {0:9}
 SSSTN     Push 1                         [9,3,1,3,3,1]   {0:9}
 TSST      Subtract top two (3-1)         [9,3,1,3,2]     {0:9}
 NTSSSN    If 0: Jump to Label_BREAK_2    [9,3,1,3]       {0:9}
 SNT       Swap top two                   [9,3,3,1]       {0:9}
 SSSTN     Push 1                         [9,3,3,1,1]     {0:9}
 TSSS      Add top two (1+1)              [9,3,3,2]       {0:9}
 SNT       Swap top two                   [9,3,2,3]       {0:9}
 STSSTSN   Copy 2nd from top              [9,3,2,3,3]     {0:9}
 TSTS      Integer-divide top two (3/3)   [9,3,2,1]       {0:9}
 NSNTN     Jump to Label_LOOP_2           [9,3,2,1]       {0:9}

 SNS       Duplicate top (1)              [9,3,2,1,1]     {0:9}
 SSSTN     Push 1                         [9,3,2,1,1,1]   {0:9}
 TSST      Subtract top two (1-1)         [9,3,2,1,0]     {0:9}
 NTSSSN    If 0: Jump to Label_BREAK_2    [9,3,2,1]       {0:9}
NSSSSN     Create Label_BREAK_2           [9,3,2,1]       {0:9}
 SNN       Discard top                    [9,3,2]         {0:9}
 TNST      Print as integer               [9,3]           {0:9}           2
                                                                                error

Program stops with an error: No exit found.

Brachylog, 2 bytes
ḋl

Try it online!
Explanation
ḋ        Prime decomposition
 l       Length

APL (Dyalog Extended), 8 2 bytes
≢⍭

Try it online!
⍭ finds factors, ≢ counts how many of them there are.

QBasic, 51 41 bytes
INPUT n
FOR i=2TO n
f=f-(n/i=n\i)
NEXT
?f

-10 bytes by copying the approach from Darren Smith's Nibbles answer: For a prime power input, the desired output equals the number of integers between 1 (exclusive) and the input (inclusive) that evenly divide the input.
INPUT number
FOR testFactor = 2 TO number
  ' number is divisible by testFactor if their float division equals
  ' their int division
  isDivisible = (number / testFactor = number \ testFactor)
  ' Truthy is -1 in QBasic, so we subtract rather than add to the tally
  numFactors = numFactors - isDivisible
NEXT testFactor
PRINT numFactors

Add++, 42 bytes
D,f,@,bUbU$^=
L,dVfbUG$XGRzGGXzÞ{f}bUbU0$:

Try it online!
I don't even know where to begin explaining this mess.
Explained
D,f,@,bUbU$^=
D,f,@,        ; a helper function f that given a list [number, [x, y]]
      bUbU$^  ;   returns whether x ^ y
            = ;   equals number

L,dVfbUG$XGRzGGXzÞ{f}bUbU0$:
L,                            ; a lambda that
  dV                          ; places its input into the register
    fbU                       ; and gets the prime factor of the input. This is guaranteed to be a single item because the input is a prime raised to a power.
       G$X                    ; push a list of input copies of that power
          GRz                 ; and zip that with the range [1...input]
             GGX              ; also, push input copies of the input
                z             ; and zip that with our big list. I'm calling it a big list because it is what it is.
                 Þ{f}         ; filter that list based on the results of the helper function f
                     bUbU0$:  ; get the power out of the many nested lists returned.

34 bytes. You can replace f with g, per this tip to save 2 bytes, use the full flatten command BF instead of two unpacks and use some stack manipulation to replace 0$:

HBL, 7 bytes
(or possibly 6.5 depending on how this meta question shakes out)
+(*'?(*%.(02.

Try it!
Explanation
+(*'?(*%.(
         (0    Inclusive range
           2    from 2
            .   to the argument
     (*        Map over each value x in that list:
       %.       Argument mod x
 (*            Map over each value in that list:
   '?           Logical negation
               The result is a list containing 1 for each number that divides
               the argument, 0 otherwise
+              Take its sum

Risky, 3 bytes
!\?___

Try it online!

A basically built-in solution for now, working on a non-trivial version (might not be possible given Risky's heavy investment in specific operators, and generally awful control flow).
!      Count
 \     Prime factors
  ?    Input
   ___ (Padding)

Nekomata, 1 byte
ƒ

Attempt This Online!
ƒ factorizes the input number, and returns a list of unique prime factors and a list of exponents.
Only the top of the stack will be printed, which is the list of exponents. Since the input is a prime power, this will be a singleton list.

Jelly, 3 2 bytes
Æḍ

Try it online!

Java 8, 59 bytes
A lambda from int to int.
x->{int f=1,c=0;while(x%++f>0);for(;x>1;c++)x/=f;return c;}

Try It Online

J, 4 bytes
#@q:

q: gives the list of prime factors, # gives the length of the list.
Try it online!

R, 37 bytes
length(numbers::primeFactors(scan()))

Try it online!

sum(x|1) is nearly always shorter than length(x)

MATL, 3 bytes
Yfz

Try it online!
Explanation:
     % Implicit input: 59049
Yf   % Factorize input [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
  z  % Number of non-zero elements: 10
     % Implicit output

Vyxal l, 1 byte
ǐ

Try it Online!
-1 byte thx to @lyxal
Length of the prime factors, the flags are cheaty+awesome

Try it Online! for 1 byte

MS Excel, 33 bytes
An anonymous worksheet function that takes input from cell A1 and outputs to the calling cell
-SUM(-(MOD(A1,SEQUENCE(A1))<1))-1

Thunno 2 L, 1 byte
f

Try it online!
Push the prime factors of the input then take the Length of the list.

Python 2, 62 bytes
def f(n,p=2,i=0):
	while n%p:p+=1
	while n>p**i:i+=1
	return i

Try it online!
Nothing fancy here.

You can save three bytes by making it a full program: Try it online!

Japt, 3 bytes
k l

Try it online!
Explanation:
k l
k     Get the prime factors of the input
  l   Return the length

Actually, 2 bytes
ol

Try it online!

Haskell, 27 bytes
f n=sum$(0^).mod n<$>[2..n]

Try it online!
Counts factors. Compare:
Haskell, 28 bytes
f n=sum[1|0<-mod n<$>[2..n]]

Try it online!
Haskell, 28 bytes
f n=sum[0^mod n i|i<-[2..n]]

Try it online!
Haskell, 30 bytes
f n=sum[1|i<-[2..n],mod n i<1]

Try it online!

Octave, 18 bytes
@(x)nnz(factor(x))

Try it online!
Does what it says on the tin: Number of non-zero elements in the prime factorization of the input.

Cjam, 5 bytes
rimf,

Try it Online!
Explanation:
ri      take the input and convert it to an int
  mf    factors the input
    ,   take the length of the list

Builtins are great!

JavaScript (Node.js), 29 bytes
f=(n,k=n)=>--k&&!(n%k)+f(n,k)

Try it online! Note: Stack overflows for larger inputs.

F#, 91 bytes
let rec d n c v=if v=n then c else d(n/v)(c+1)v
let p n=d n 1(Seq.find(fun x->n%x=0){2..n})

Try it online!
p gets the prime factor. d recursively divides the target value until it's equal to the prime factor and returns the count from that.

Julia, 19 bytes
port of Xi'an's answer in R
n->sum(n.%(2:n).<1)

Try it online!

Retina 0.8.2, 30 bytes
.+
$*
((?=(1+)(\2+)$)\3)+1
$#1

Try it online! Link includes test cases. Explanation:
.+
$*

Convert the input to unary.
((?=(1+)(\2+)$)\3)+1

Repeatedly find the largest factor of the current value. Eventually this becomes 1, which is then matched at the end outside of the loop.
$#1

Output the resulting number of factors, which for a prime power will be the power.

Factor + math.primes.factors, 18 bytes
[ factors length ]

Try it online!

Excel, 34 bytes
=SUM((MOD(A1,SEQUENCE(A1-1))=0)*1)

Link to Spreadsheet
Counts the factors.  Works up to 2 ^ 20.

Husk, 2 bytes
Lp

Try it online!
Explanation
Lp
L  length of
 p prime factors

BQN, 7 bytesSBCS
+´0=↕|⊢

Run online!
Translates directly to Dyalog APL:
+/0=⍳|⊢

Try it online!

Gaia, 2 bytes
ḍl

Try it online!

JavaScript (ES6), 37 bytes
f=(n,k=2)=>n%k?n>1&&f(n,k+1):1+f(n/k)

Try it online!

Perl 6, 36 bytes
{round .log/log (2..*).first: $_%%*}

Looks for the first factor (2..*).first: $_%%*, then from there calculates the approximate value (logs won't get it exact) and rounds it.
Try it online!

Pari/GP, 8 bytes
bigomega

Try it online!

bigomega(x): number of prime divisors of x, counted with multiplicity.

Pari/GP, 14 bytes
n->numdiv(n)-1

Try it online!

Racket, 31 bytes
(car(cdr(perfect-power(read))))

Try it online!

Perl 6, 18 bytes
{+grep($_%%*,^$_)}

Try it online!
Anonymous code block that gets a list of factors and coerces it to a number.