Sci-fi story idea: AI of a starship discovers that going through a puberty increases lifespan by 5…

Sci-fi story idea: AI of a starship discovers that going through a puberty increases lifespan by 5 years, and thus begins putting the entire crew through forced feminization and then forced masculinization, back and forth indefinitely, to keep them all alive until they can reach their destination.