Let $s: \{0,1\}^*$ be a bitstring of length $k$.
Let $n$ be the integer you get by prepending a $1$ to $s$ (to capture leading $0$s), and interpreting it as a base-2 integer.
Let $p$ be the next prime larger than $n^2$. (Squaring $n$ is overkill and could be relaxed some for optimization; the important part here is ensuring no overlap in primes checked in the next step for any two different input strings, particularly for small $k$ values.)
Then, the resulting string $f(s)\rightarrow r$ will be determined by comparison against the $k$ next primes $q_i$ following $p$, where $p \equiv q_i \pmod {3}$ yields a $1$, and $0$ otherwise.
While there will of course be some correlation of the mod-$3$ values of contiguous primes, my understanding is that it should disappear in the limit. Presumably, correlation near $2^k$ fades more quickly than $k$ grows, and a few experiments appear to confirm that. Since the formal definition of a OWF deals with large $k$, that seems like it should be good enough.
I'm wondering whether this sounds like a viable approach. I see no way of systematically constructing a preimage corresponding to some given output $r$, even for small $k$. In particular, finding an input which gives an $r$ with $19$ out of $20$ bits correct buys you nothing. That said, while brute forcing a solution, one need only check primes until reaching a prime with the wrong parity. That said, while it may speed things by up to a factor of $k$, it still leaves you in NP.
Lastly, I realize it's not especially fast, but I'm mostly interested in the potential theoretical soundness of it. It boils down to this: given a sequence of integers $\pmod{3}$ that must match some contiguous primes, is there any way to find such primes that's substantially better than brute force? (i.e. findable in polynomial time.) And if there isn't, can that be proven?
Example
If $s=\{0,1,1\}$, then we have $n=1011_2=11$.
Next prime after $11^2$ gives $p=127\equiv 1 \pmod{3}$, with $q_1=131,q_2=137,q_3=139$.
So $q_{i\in I} \equiv \{2,2,1\} \pmod{3}$.
Compare those to our value for $p$, and our equality results are $r=\{0,0,1\}$, giving us our function image.
For anyone who cares, here's some Mathematica code for it:
owf[n_Integer] := FromDigits[owf[IntegerDigits[n, 2]], 2]
owf[s_List] := Module[{r = {}, p, t},
t = p = NextPrime[FromDigits[Prepend[s, 1], 2]^2];
While[Length[r] < Length[s],
t = NextPrime[t];
AppendTo[r, Boole[Mod[t, 3] == Mod[p, 3]]];
];
r
]
Row[{First@Timing[t = owf[RandomInteger[1, 256]];], "s, correlation=",
AutocorrelationTest[t]}]
yielding e.g. 3.29688s, correlation=0.451483 (or comparable values) for a random 256-bit input, which seems promising to me. It also appears to give suitably random results for e.g.
owf /@ Range[16, 31]
==> {12, 27, 20, 13, 13, 12, 4, 15, 8, 9, 11, 2, 19, 25, 10, 23}