⏱ 00:00
Attempts:0
Best: 0/100
Prime & Parity Matrix SynthesisTarget Time: 25 mins
Prime & Composite Token Matrix
Given an integer N, generate an N x N matrix numbered from 1 to N² row-wise. Replace every prime number with "P", every composite even number with "E", and every composite odd number with "O". Replace 1 with "#". Output space-separated tokens.
Input Format
A single integer N.
Output Format
Print N rows with the substituted tokens.
Constraints:1 <= N <= 10
Concepts Required:
Primality testing O(sqrt(X))Multi-condition categorization (Prime, Even, Odd, Unit)Grid string substitution
Expected Pattern PreviewASCII Monospace
N=3 (1 to 9): # P P E P E P E O
Notice how character spacing and row counts scale systematically based on the input N.
Concrete Examples
Example 1
Input:
3
Output:
# P P E P E P E O
Explanation: 1->#, 2->P, 3->P, 4->E, 5->P, 6->E, 7->P, 8->E, 9->O.
