(skip to content)

An exercise for the reader

An exercise for the reader

Take the following two large numbers:

p=5213436955487338931744369q=72398891673349755598314\begin{aligned} p &= 5213436955487338931744369 \\ q &= 72398891673349755598314 \end{aligned}
  • (a)(a) Apply the Euclidean algorithm to compute gcd(p,q)\gcd(p,q).
  • (b)(b) Let q0,q1,,qnq_0, q_1, \ldots, q_n denote the successive quotients obtained in (a)(a). Determine nn.
  • (c)(c) Let Σ\Sigma denote the set of printable ASCII characters and let f ⁣:{0,,127}Σf \colon \{0,\ldots,127\} \to \Sigma be the function mapping each integer to the character with that code point. Evaluate the string f(q0)f(q1)f(qn)f(q_0)\, f(q_1) \cdots f(q_n).
Show solutionHide solution
# use this python oneliner
f=lambda p,q:[p//q]+f(q,p%q)if q else[];print(''.join(map(chr,f(5213436955487338931744369,72398891673349755598314))))