開発環境
- macOS Mojave - Apple (OS)
- Emacs (Text Editor)
- Windows 10 Pro (OS)
- Visual Studio Code (Text Editor)
- Python 3.7 (プログラミング言語)
Programming Bitcoin: Learn How to Program Bitcoin from Scratch (Jimmy Song(著)、O'Reilly Media)のChapter 2(Elliptic Curves)、Coding Elliptic Curves in Python、Exercises 1(27)の解答を求めてみる。
コード
Python 3
#!/usr/bin/env python3 points = [(2, 4), (-1, -1), (18, 77), (5, 7)] for x, y in points: if y ** 2 == x ** 3 + 5 * x + 7: print(f'({x}, {y}) is on the curve.') else: print(f'({x}, {y}) is not on the curve.')
入出力結果(cmd(コマンドプロンプト)、Terminal、Jupyter(IPython))
C:\Users\...>py -3 sample1.py -v (2, 4) is not on the curve. (-1, -1) is on the curve. (18, 77) is on the curve. (5, 7) is not on the curve. C:\Users\...>
0 コメント:
コメントを投稿