gmp_init(): Don't use leading 0x or 0b if different base specified

Fixes bugs #50175 and #55398.

Made pull request against master; backport to older branches if you wish.

@smalyshev @TazeTSchnitzel @nikic