testable version of number resequencing