numeric algorithm adjacent_difference
adjacent_difference from gnzlbg