How to filter an array of floats if multiple floats belong to each other?

Hello,
I have an array of floats. A block of 5 floats belongs to one “object”.

If the 3rd element equals 17 it shall be removed. What is the most straightforward way to do this?

Example:
Input:
[1, 1, 1, 1, 1, 2, 2, 17, 2, 2, 3, 3, 3, 3, 3, 4, 4, 17, 4, 4]
desired Output:
[ 2, 2, 17, 2, 2, 4, 4, 17, 4, 4]

I saw this post already: Array filtering in CUDA
But there was no issue with the index and the “block”. Maybe someone can help :)