replace every nth occurrence of a pattern using awk

I'm trying to replace every nth occurrence of a string in a text file.

background:
I have a huge bibtex file (called in.bib) containing hundreds of entries beginning with "@". But every entry has a different amount of lines. I want to write a string (e.g. "#") right before every (let's say) 6th occurrence of "@" so, in a second step, I can use csplit to split the huge file at "#" into files containing 5 entries each.

replaces 2nd until 5th occurance (and no more).
(btw, I found and adopted this solution here: "Sed replace every nth occurrence". Initially, it was meant to replace every second occurence--which it does.)