Strict local extremum without $f'$ "changing signs"

Let $f:\mathbb{R}\to \mathbb{R}$. Is it possible that $f$ has the following properties:

1. $f$ is differentiable in a neighborhood of $a\in \mathbb{R}$
2. $a$ is a strict local minimum
3. There is no neighborhood $(a-\delta, a+\delta)$ of $a$ such that $f'<0$ in $(a-\delta, a)$ and $f'>0$ in $(a,a+\delta)$?

It is definitely possible if we require only that $a$ be a (non-strict) local minimum; the function $x^2\sin^2(1/x)$ exhibits such behavior at zero.

It is definitely impossible if $f$ is a polynomial, since we can write $f(x) = (x-a)^mg(x) + f(a)$, where $g(a)\neq 0$, and $f(x)-f(a)$ behaves locally like $(x-a)^m$. (This also shows that if $f$ is a polynomial, $f$ has a local extremum at $a$ iff $f'$ has a zero of odd order at $a$.)

I believe it is impossible if $f'$ is continuous at $a$, since then I claim that $f$ has a local extremum iff $f'$ has a neighborhood as in property (3).

If you're interested, the way I came up with this question is: I was showing that if $f=x^n + a_{n-1}x^{n-1} + \dotsb + a_1x + a_0$ has number of local maxima equal to $k_1$, and number of local minima equal to $k_2$, then $k_1=k_2$ if $n$ is odd, and $k_1 + 1=k_2$ if $n$ is even. I wondered if a similar property held for non-polynomial functions if we require that they be strict local maxima and minima.

• See Example 4 here for an example with $f'$ satisfying the continuity condition. If you can't access it, the function is $f(x)=x^4\bigl(2+\sin(1/x)\bigr)$, $x\ne0$; $f(0)=0$. Aug 10, 2014 at 21:39

How about $$f(x)=\begin{cases}x^2(2+\sin(1/x)) & x\ne 0 \\ 0 & x=0 \end{cases}$$ Differentiable everywhere, global minimum at $x=0$, derivative both positive and negative in any interval with $0$ as an endpoint.