# [C (gcc)], 91 bytes

<!-- language-all: lang-c -->

    i;q;p;m;f(b){for(q=0,p=m=b;p|!q;++m)for(q=p=i=1;++i<m;p=p&&m%i)q=m%i?q:q&&(b*b*b-b)%i;--m;}

[Try it online!][TIO-kg8dn4dv]

[C (gcc)]: https://gcc.gnu.org/
[TIO-kg8dn4dv]: https://tio.run/##bVHdToMwGL3fU1QSSLt9RKBjA7vqhfEptl0MBtpEWPmJIU6eHT9WNjWRtpTz9ZzT9pC6r2k6DEpUQotC5DRh5/xU00p6oGUhE6G/7iqxWBTMlLVU0kesNoXQUjtOYStWSXw/VQ@V49Bkjs1NmK2E6xaiH1TZkuKgSspm5xnBZyy0WdM22z2R5BxACCvwPfADCNbAA@BL4GuIsEcQxVj3cXAIvLgXN4es01naZsfJJISlYeKEIAyBh@Cv4hHH/tR9zpETQhBdndK3Qz0ntTGxdt1LsOviZxyhBeQ35takwBgIHQ@gymPWocwT0@eGNOozO@X0cjl2P6G5gYJgaCOPERPD9SIkQROTx2V9L27LukZCTi37SNxHgidKmPijrbP24/CO@vHH/auzm12JQkPEeXuVyJ8Ezbb7yaCf9cM3 "C (gcc) – Try It Online"  

Port of my [Python answer](https://codegolf.stackexchange.com/a/213463/9481).