Cody

# Problem 2051. is the number happy?

Solution 668786

Submitted on 11 May 2015 by Zikobrelli
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
%% n = 1; y_correct = 1; assert(isequal(ishappy(n),y_correct))

i = 1

2   Pass
%% n = 2; y_correct = 0; assert(isequal(ishappy(n),y_correct))

i = 1 n = 0

3   Pass
%% n = 31; y_correct = 1; assert(isequal(ishappy(n),y_correct))

i = 1 n = 10 i = 2 n = 1 i = 3

4   Pass
%% n = 13; y_correct = 1; assert(isequal(ishappy(n),y_correct))

i = 1 n = 10 i = 2 n = 1 i = 3

5   Pass
%% n = 11; y_correct = 0; assert(isequal(ishappy(n),y_correct))

i = 1 n = 2 n = 0 i = 2

6   Pass
%% n = 101; y_correct = 0; assert(isequal(ishappy(n),y_correct))

i = 1 n = 2 n = 0 i = 2

7   Pass
%% n = 100; y_correct = 1; assert(isequal(ishappy(n),y_correct))

i = 1 n = 1 i = 2

8   Pass
%% n = 130; y_correct = 1; assert(isequal(ishappy(n),y_correct))

i = 1 n = 10 i = 2 n = 1 i = 3

9   Pass
%% n = 230; y_correct = 1; assert(isequal(ishappy(n),y_correct))

i = 1 n = 13 i = 2 n = 10 i = 3 n = 1 i = 4

10   Pass
%% n = 190; y_correct = 1; assert(isequal(ishappy(n),y_correct))

i = 1 n = 82 i = 2 n = 68 i = 3 n = 100 i = 4 n = 1 i = 5

11   Pass
%% n = 290; y_correct = 0; assert(isequal(ishappy(n),y_correct))

i = 1 n = 85 i = 2 n = 89 i = 3 n = 145 i = 4 n = 42 i = 5 n = 20 i = 6 n = 4 n = 0 i = 7

12   Pass
%% n = 998; y_correct = 1; assert(isequal(ishappy(n),y_correct))

i = 1 n = 226 i = 2 n = 44 i = 3 n = 32 i = 4 n = 13 i = 5 n = 10 i = 6 n = 1 i = 7