I solved this problem in a similar way some time ago. It was impractical to assign numbers to snapshots but each snapshot had a date assigned to it. So I computed the number of days since Unix epoch for each snapshot = n. Then the largest power of 2 which divides n. m = n &(~(n-1)) I think. Then I computed the date after which I wanted to delete a snapshot n +f*m. The factor f contros the density. I chose f = 2.
Every day there is exactly one date for which a snapshot needs to be deleted and it can be computed directly. If there is no snapshot for this date nothing needs to be done.
Every day there is exactly one date for which a snapshot needs to be deleted and it can be computed directly. If there is no snapshot for this date nothing needs to be done.