Cody

# Problem 44377. Five steps to enlightenment

Solution 1356486

Submitted on 24 Nov 2017 by HH
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass

2   Pass
% X,Y X<Y between 2 and 100 [x,y]=find(triu(ones(100),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==true);

3   Pass
% X,Y X<Y between 2 and 60 [x,y]=find(triu(ones(60),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==false);

4   Pass
% X,Y X<Y between 2 and 200 [x,y]=find(triu(ones(200),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==true);

5   Pass
% X,Y X<Y between 2 and 1680 [x,y]=find(triu(ones(1680),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==true);

6   Pass
% X,Y X<Y between 2 and 1700 [x,y]=find(triu(ones(1700),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==false);

7   Pass
% X,Y X<Y between 1 and 20 [x,y]=find(triu(ones(20),1)); z=[x y]; valid=all(z>=1,2); assert(fivesteps(z(valid,:))==false);

8   Pass
% X,Y X<Y between 1 and 30 [x,y]=find(triu(ones(30),1)); z=[x y]; valid=all(z>=1,2); assert(fivesteps(z(valid,:))==true);

9   Pass
% X,Y X<Y between 1 and 40 [x,y]=find(triu(ones(40),1)); z=[x y]; valid=all(z>=1,2); assert(fivesteps(z(valid,:))==false);

10   Pass
% X,Y X<Y between 3 and 5000 [x,y]=find(triu(ones(3000),1)); z=[x y]; valid=all(z>=3,2); assert(fivesteps(z(valid,:))==true);

11   Pass
% X,Y X<Y between 3 and 100 [x,y]=find(triu(ones(100),1)); z=[x y]; valid=all(z>=3,2); assert(fivesteps(z(valid,:))==false);

12   Pass
% X,Y X<Y even between 2 and 40 [x,y]=meshgrid(2:2:40); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

13   Pass
% X,Y X<Y odd between 1 and 1000 [x,y]=meshgrid(1:2:1000); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

14   Pass
% X,Y X<Y non-primes between 1 and 50 [x,y]=meshgrid(setdiff(1:50,primes(50))); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

15   Pass
% X,Y X<Y primes between 1 and 50 [x,y]=meshgrid(primes(50)); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

16   Pass
% X,Y X<Y random subset [x,y]=meshgrid([3 5 12 18 20 28 30]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

17   Pass
% X,Y X<Y random subset [x,y]=meshgrid([3 5 12 15 28 30]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

18   Pass
% X,Y X<Y random subset [x,y]=meshgrid([2 4 6 8 12 16 18]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

19   Pass
% X,Y X<Y random subset [x,y]=meshgrid([4 6 8 12 16 18]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

20   Pass
% X,Y X<Y random subset [x,y]=meshgrid([2 3 10 14 15 20 21]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

21   Pass
% X,Y X<Y random subset [x,y]=meshgrid([2 3 5 8 10 14 15 20 21]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

22   Pass