logo
P
Prompt Master

Prompt 大师

掌握和 AI 对话的艺术

Infinite Primes (Shakespeare)

Creative proof prompt example

TL;DR

  • This is a "math proof + style writing" creativity test: maintain the core proof logic while expressing it as a Shakespeare dialogue.
  • Good for: style transfer, long-text structure control, and generating coherent content under heavy constraints.
  • Key risk: the style lands but the proof logic breaks. Require the output to explicitly include key steps (e.g., Euclid-style construction), and use evaluation to check logical completeness.

Background

The following prompt tests an LLM's capabilities to write a proof that there are infinitely many primes in the style of a Shakespeare play.

How to Apply

When using this prompt for similar tasks, split constraints into two layers:

  1. Content constraints: Which core argument steps must be included (proof skeleton)
  2. Style constraints: What voice, structure, and rhetoric to use (dialogue, stage directions)

For math proofs, you can first ask the model to output a short proof outline (keeping English terms), then have it rewrite the outline in a specific style.

How to Iterate

  1. Force inclusion of key proof steps (e.g., "construct N = p1p2...*pk + 1")
  2. Add structure: each character handles one step (setup → contradiction → conclusion)
  3. Add self-check: end with a 3-5 line summary of the proof's logical chain (so style doesn't mask errors)
  4. Control length: specify acts/scenes or a token budget

Self-check Rubric

  • Is the proof complete with no obvious logical gaps?
  • Does the dialogue maintain Shakespeare style (consistent voice)?
  • Are the math steps expressed clearly enough for a reader to verify?
  • Does it avoid introducing irrelevant tangents?

Practice

Exercise: rewrite the same proof skeleton in 3 different styles:

  • Shakespeare dialogue
  • courtroom cross-examination
  • a children's story

Then use the same rubric to check whether the proof still holds.

Prompt

Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof.

Code / API

OpenAI (Python)

from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {
            "role": "user",
            "content": "Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof.",
        }
    ],
    temperature=1,
    max_tokens=1000,
    top_p=1,
    frequency_penalty=0,
    presence_penalty=0,
)

Fireworks (Python)

import fireworks.client

fireworks.client.api_key = "<FIREWORKS_API_KEY>"

completion = fireworks.client.ChatCompletion.create(
    model="accounts/fireworks/models/mixtral-8x7b-instruct",
    messages=[
        {
            "role": "user",
            "content": "Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof.",
        }
    ],
    stop=["<|im_start|>", "<|im_end|>", "<|endoftext|>"],
    stream=True,
    n=1,
    top_p=1,
    top_k=40,
    presence_penalty=0,
    frequency_penalty=0,
    prompt_truncate_len=1024,
    context_length_exceeded_behavior="truncate",
    temperature=0.9,
    max_tokens=4000,
)

Reference