MacOS Pythonにpytest インストール

$ python -m pip install pytest

インストールできたものの

$ pytest
zsh: command not found: pytest

あれれ?

$ which pytest
$ whereis pytest

だめだ、見つからない!
そこで一旦アンインストールすることに

$ python -m pip uninstall pytest
Found existing installation: pytest 6.2.4
Uninstalling pytest-6.2.4:
  Would remove:
    /Users/sakuraisusumu/.local/bin/py.test
    /Users/sakuraisusumu/.local/bin/pytest
    /Users/sakuraisusumu/.local/lib/python3.6/site-packages/_pytest/*
    /Users/sakuraisusumu/.local/lib/python3.6/site-packages/pytest-6.2.4.dist-info/*
    /Users/sakuraisusumu/.local/lib/python3.6/site-packages/pytest/*
Proceed (Y/n)? 

ここでようやくpytestの場所が判明
さっそく.zprofileにPATHを通してOK

解決問題「コラッツ・角谷予想」(後半)

空間情報連載
Pythonで数学を学ぼう!

桜井進のPython+Math教室 第9回

Pythonで数論!未解決問題「コラッツ・角谷予想」(後半)
1.コラッツ予想

2.コラッツ・シークエンスのステップ数
コラッツ・シークエンスのステップ数を求めるコード

# colg.py
# ステップ数(最大ステップ数)と頻度のグラフ描画
import numpy as np                  # 配列を扱う数値計算ライブラリNumPy
import matplotlib.pyplot as plt     # グラフ描画ライブラリmatplotlib
import japanize_matplotlib          # matplotlibの日本語化
import datetime as dt
from decimal import Decimal

while(1):
  Model = input('1.a≦n≦bに対するコラッツ・シークエンスのステップ数の最大値とnを算出\r\n'
                '2.a≦n≦bに対する横軸ステップ数、縦軸頻度の棒グラフ描画\r\n'
                '1、2のどれかを入力 ')
  if Model.isdecimal():
    Model = int(Model)
    if 1 <= Model <= 2:
      break