I'll expand on MelBurslan's comment. I'm answering this from the perspective of a full-time freelancer/consultant who used to work in the corporate world.
If you were not an employee of this company, you are an independent worker (with or without a contract, though ideally with one). You can just put self-employed in that case and not say which periods you were actually working for this client. It is common for freelancers or consultants to put who their client list includes.
This is generally acceptable in the world of freelancing because freelancing is inherently feast-or-famine. For example, I know of an independent web designer who I read is considered one of the best web designers in the world; he said even he goes through periods where he has no work.
This is generally more credible if you see your freelance work as a business and have a business structure for it. This could be a corporation (probably overkill if it's just you), LLC or equivalent, or even a sole proprietorship which has a name.
For example, I own an LLC for my consulting business. In the work I do, there are sometimes some stages of a project where a client doesn't need very much (or even any) of my time. I'm not "not working" during those periods, because I just use the time that I am waiting for the next stage of a project (where I am needed again) to build my business and work on side projects. (Edit: and I still have that client even if we're currently working 0 hours a week together.)
So my résumé lists that I have owned a consulting business this whole time and describes what I have been working on, both with my clients and on my business. Building a real-life business (even if it's only one person) and studying how to do that helps me bring more value to companies that I work with in the future because it allows me to understand more about how they operate.
Some sources: