0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

大人用 集合と命題「2026年 共通テ◯ト数学ⅠA第1問[1]のみ」を (その1/2)AI先生へ。sympyのソースコードを教えて下さい 。

Last updated at Posted at 2026-01-22

(その1/2) 本ページ
(その2/2) 作成中

・私の質問の仕方が悪いかもです。私は,集合と命題 の勉強開始です。

オリジナル

・問題文 のmatjax
 2026 大学入学共通テ◯ト 本試験 数学I・数学IAMathJax 第1問[1]
 < 大学入試数学問題集成 様へ。 いつもお世話になっております。
 https://mathexamtest.jp/2026/202610000/2026100000100mj.html

(本日の)ChatGPT先生へ。

mathjaxの丸投げ

質問文;

(mathjax省略:上記問題文参照)

(回答省略)

sympy のソースコードを指定して。

質問文;

sympy のソースコードを教えて下さい。 全体版でお願いします。
(mathjax省略:上記問題文参照)

回答途中省略:

1. sympy のソースコードを教えて下さい。全体版でお願いします。
2. 「答案形式(ア〜キを直接出力)」で
3. 回答群 も追加して。
4. イ 間違っています。直して全体版で。
5. オ と キ を直して
6. 上記の私の質問すべてから、Markdownのテキスト形式で、質問リストを出力して。
7. テキスト形式で。シンプルに。コピーできる形式で。本質問も含めて。空白行不要です。追番も。コピーできる形式で。いつもの形式で。コードをこぴーする 形式で

回答:

from sympy import gcd

# -----------------------------
# 基本定義
# -----------------------------
U = set(range(2, 21))

def A_set(a):
    return {k for k in U if gcd(k, a) >= 2}

def B_set(b):
    return {k for k in U if gcd(k, b) >= 2}

def comp(S):
    return U - S

# -----------------------------
# 回答群
# -----------------------------
answer_groups = {
    0: {12},
    1: {3, 9},
    2: {3, 9, 15},
    3: {6, 12, 18},
    4: {3, 6, 9, 15, 18},
    5: {4, 8, 12, 16, 20},
    6: {3, 6, 9, 12, 15, 18},
    7: {2, 4, 8, 10, 14, 16, 20},
    8: {2, 4, 6, 8, 10, 12, 14, 16, 18, 20},
    9: {2, 3, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20}
}

def group_number(S):
    for k, v in answer_groups.items():
        if S == v:
            return k
    return None

# =============================
# 【1】(1)
# =============================
a = 3
b = 4

A = A_set(a)
B = B_set(b)

print("【1】(1)")
print(f"ア = {sorted(A)} → 回答群 {group_number(A)}")
print(f"イ = {sorted(B)} → 回答群 {group_number(B)}")
print(f"ウ = {sorted(A & B)} → 回答群 {group_number(A & B)}")
print(f"エ = {sorted(A & comp(B))} → 回答群 {group_number(A & comp(B))}")

# =============================
# 【1】(2)(ⅰ)
# =============================
ans_O = None
for a in range(2, 10):
    Abar = comp(A_set(a))
    if all(k % 2 != 0 and k % 3 != 0 for k in Abar):
        ans_O = a
        break

print("\n【1】(2)(ⅰ)")
print("オ =", ans_O)

# =============================
# 【1】(2)(ⅱ)
# =============================
ans_KA = None
ans_KI = None

for a in range(2, 10):
    for b in range(2, 10):
        if A_set(a) & comp(B_set(b)) == {5}:
            ans_KA = a
            ans_KI = b
            break
    if ans_KA is not None:
        break

print("\n【1】(2)(ⅱ)")
print("カ =", ans_KA)
print("キ =", ans_KI)

最終答案まとめ(試験用)
ア:⑥
イ:⑧
ウ:③
エ:②
オ:6
カ:5
キ:6
これで 完全に正解・矛盾なしです。

大丈夫かしら。 (DeepL翻訳より:Is everything all right?)

sympyで(いつもの方法で)

(勉強中)

# ver0.1

Gemini3先生へ。

(未)

いつもの? sympyの実行環境と 参考のおすすめです。

(テンプレート)

いつもと違うおすすめです。

Wikipediaで

Qiitaで

sympyのdocで

検索で(次行は、◯→ス の意味です。)

・chatgpt 2026 共通テ◯ト 満点

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?