Problem 83. Prime factor digits
Consider the following number system. Calculate the prime factorization for each number n, then represent the prime factors in a vector like so:
13 11 7 5 3 2
---------------
2: 1
3: 1 0
4: 2
5: 1 0 0
6: 1 1
12: 1 2
14: 1 0 0 1
18: 2 1
26: 1 0 0 0 0 1
60: 1 1 2
Each "place" in the number system represents a prime number. Given n, return the vector p.
As shown above, if n = 26, then p = [1 0 0 0 0 1].
The input n is always an integer greater than 1. Suppress any leading zeros. The length of the vector is determined by the largest prime factor.
Solution Stats
Problem Comments
-
5 Comments
Show
2 older comments
Peter
on 15 Feb 2023
I'm sure Test 4 & 6 are incorrect!
Dyuman Joshi
on 16 Feb 2023
@Peter, what makes you think so?
Peter
on 24 Feb 2023
@Dyuman Joshi,
I was wrong! My thinking was wrong!
Solution Comments
Show commentsGroup

Computational Geometry II
- 20 Problems
- 18 Finishers
- Dots in a Diamond
- Property dispute!
- Shifted Hexagonal Tiling Dots in a Circle
- Hexagonal Tiling Dots in a Circle
- Dots in a Sphere
- Triangular Tiling Dots in a Circle
- Beads on a Necklace (Convex Hulls)
- Minimum Distance between two N-sided Polygons
- Minimum Distance Point to Segment
- Dots in a Circle
- Edges of a n-dimensional Hypercube
- Volume of a Simplex
- Find the optimal shape to bring the maximum product by a given perimeter
- Number of lattice points within a circle
- Points on a circle.
- Perimeter
- Geometry: Find Circle given 3 Non-Colinear Points
- Points on a Sphere
- Volume difference between Ellipsoid and Sphere
- Property dispute!
- Crossing to Kissing - Untangle the Lines
Problem Recent Solvers2385
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!