President Donald Trump said on Thursday that Tim Cook, the former Apple chief executive, should replace Jensen Huang as the chief executive of Nvidia, hours after Huang resigned following reports of an affair with a woman U.S. authorities suspect of spying for China.

"NOW THAT Nvidia CEO JENSEN HUANG, who has done a fantastic job, has resigned, there is only one man to take his place - TIM COOK of Apple," Trump wrote on social media. "A Legend replaces a Legend!" he added.

Cook stepped down as Apple's chief executive in September after a 15-year stint running the company and is now executive chairman of the iPhone maker. Last year, Cook presented Trump with a custom U.S.-made plaque mounted on a 24-carat gold stand commemorating Apple's "American Manufacturing Program," after saying the company would invest an additional $100 billion in domestic manufacturing.

Huang resigned as Nvidia's chief executive and as a member of its board on Thursday with immediate effect. Nvidia said its chief financial officer, Colette Kress, will serve as interim chief executive while the board searches for a permanent successor. Trump said on Monday that he had spoken to Huang and that the chief executive told him he did not know the woman linked to him was allegedly a spy.

Huang is one of Trump's closest allies in Silicon Valley, a relationship that dates to at least 2025. Over the past two years, Huang has repeatedly voiced support for the administration's agenda and become a regular presence in Washington as Nvidia sought to sell advanced chips to the Chinese market. Apple and Cook did not immediately respond to requests for comment, and there was no indication that Cook wanted the Nvidia job.