Classify a Number as Even / Odd and Prime
Easy
Given an integer ri!number, write an Appian expression that determines:
- Whether the number is Even or Odd.
- Whether the number is Prime.
- Return the result as:
- "Even / Prime"
- "Odd / Prime"
- "Even"
- "Odd"
A prime number must be an integer greater than 1 and have exactly two factors: 1 and itself.
Examples:
- 27 → "Odd"
- 28 → "Even"
- 29 → "Odd / Prime"
- 2 → "Even / Prime"
- 1 → "Odd"
ri! Rule Inputs
ri!numberNumber (Integer)0
Example 1 — Case 1
Input: ri!number
4
Output:
"Even"
Example 2 — Case 2
Input: ri!number
2
Output:
"Even / Prime"
Example 3 — Case 3
Input: ri!number
27
Output:
"Odd"
Example 4 — Case 4
Input: ri!number
53
Output:
"Odd / Prime"
Appian Expression Tips
- • Use
ri!variableNamefor rule inputs - • Use
a!localVariables(local!x: …, body)for locals - • Use
a!forEach(items: …, expression: fv!item)to iterate - • Use
where()/reject(fn!isnull, list)to filter