Problem 156. Parasitic numbers
Test whether the first input x is an n-parasitic number: http://en.wikipedia.org/wiki/Parasitic_number. ( n is the second input.)
Examples:
parasitic(128205,4) ---> true
parasitic(179487,4) ---> true
parasitic(179487,3) ---> false
Solution Stats
Problem Comments
-
5 Comments
Show
2 older comments
John D'Errico
on 30 Sep 2016
I've added some test cases, that will make it a bit more difficult to game this problem.
JD
on 7 Nov 2016
Cases 5 and 7 are identical, and I believe they are both wrong. 5 x 142857 = 714285. Isn't this a parasitic number? What am I missing?
Jess Stuart
on 8 Feb 2017
Can the problem creator disqualify "solutions" that cheat? There should be a point penalty (-200) associated with cheating too.
Solution Comments
Show commentsGroup

Basics - Cell Arrays
- 10 Problems
- 1277 Finishers
- Cell joiner
- Create a cell array out of a struct
- Convert a numerical matrix into a cell array of strings
- Split a string into chunks of specified length
- Convert a Cell Array into an Array
- Remove element(s) from cell array
- Cell Counting: How Many Draws?
- String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values
- Fix the last element of a cell array
- Natural numbers in string form
Problem Recent Solvers299
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!