Convert number to a base where its representation has most "4"s Inspired by this. There is a number, given as either integer, string or array of digits (your choice). Find the base in which the representation of the number will have most "4"s and return that base.

Number    Result
624        5
444       10
 68       16


restrictions: 


The base returned should not be greater than the input.
numbers less than or equal to abs(4) should not be considered valid input, so undefined returns are acceptable
APL (31 19)

Now tests all possible bases.

⊃⍒{+/4=K⊤⍨K⍴⍵}¨⍳K←⎕


Explanation:


⍳K←⎕: read user input, store in K. Make a list from 1 to K, which are the bases to try.
{...}¨: for each of these, run the following function
K⊤⍨K⍴⍵: encode K into that base giving a list of digits (as numbers) per base. Use K digits (a big overestimate, but it doesn't matter because the unused ones will all be zero anyway).
4=: see which of these are equal to 4
+/: sum these, now we know how many fours per base
⊃⍒: give the indices of the list if it were sorted downwards, so the index of the biggest one is at the front. Take the first item of this list.