{ "cells": [ { "cell_type": "markdown", "id": "3bbfb66e", "metadata": {}, "source": [ "# [Distinct Powers](https://projecteuler.net/problem=29)\n", "\n", "Python offers a [built-in set type](https://docs.python.org/3/library/stdtypes.html) that will only keep track of distinct items for us. We also don't need to worry about overflows, since integers are unlimited precision." ] }, { "cell_type": "code", "execution_count": 1, "id": "9fa32dcf", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "9183" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len({a ** b for a in range(2, 101) for b in range(2, 101)})" ] }, { "cell_type": "markdown", "id": "d7afa770", "metadata": {}, "source": [ "#### Copyright (C) 2025 filifa\n", "\n", "This work is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International license](https://creativecommons.org/licenses/by-sa/4.0/) and the [BSD Zero Clause license](https://spdx.org/licenses/0BSD.html)." ] } ], "metadata": { "kernelspec": { "display_name": "SageMath 9.5", "language": "sage", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.2" } }, "nbformat": 4, "nbformat_minor": 5 }