Simple function in Java
I wouldn't search for a "rule", just store the "truncate points"

private final static int[] truncateSizes = {10,7,5,3,1,0};

public int generateListSize(int listSize) {
   for(int truncateSize  : truncateSizes) {
      if (listSize &gt;= truncateSize) { 
        return truncateSize; 
      }
   }
   throw new IllegalArgumentException("Negative list size");
}