Case 1: I would like to find the largest two divsors, 'a' and 'b', of a non-prime integer, N such that N = a*b. For instance if N=24, I would like to a code that finds [a,b]=[4,6] not [a,b] = [2,12] etc.
Case 2: If N is prime, say N=11, how do I do this for the next non-prime number? so N=11->N=12 and [a,b] = [3,4].
(For context, I have a loop that generates a number of traces to be plotted where the value N is not known ahead of time. Sometimes N=3 and sometimes N=23. I'm trying to arrange the plots with subplot in a mostly 'square' arrangement that isn't just a skinny column or a skinny row. ).