Cody

# Problem 1887. Graceful Graph: Wichmann Rulers

Solution 332250

Submitted on 10 Oct 2013 by Mark Hanus
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
%% tic n=17; exp=101; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 45 c = 85 c = 101 Elapsed time is 0.083043 seconds.

2   Pass
%% n=19; exp=123; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 51 c = 99 c = 123 Elapsed time is 0.130331 seconds.

3   Pass
%% n=23; exp=183; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 63 c = 127 c = 167 c = 183 Elapsed time is 0.175170 seconds.

4   Pass
%% n=29; exp=289; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 81 c = 169 c = 233 c = 273 c = 289 Elapsed time is 0.221726 seconds.

5   Pass
%% n=31; exp=327; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 87 c = 183 c = 255 c = 303 c = 327 Elapsed time is 0.267057 seconds.

6   Pass
%% n=37; exp=465; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 105 c = 225 c = 321 c = 393 c = 441 c = 465 Elapsed time is 0.312106 seconds.

7   Pass
%% n=41; exp=573; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 117 c = 253 c = 365 c = 453 c = 517 c = 557 c = 573 Elapsed time is 0.359219 seconds.

8   Pass
%% n=43; exp=627; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 123 c = 267 c = 387 c = 483 c = 555 c = 603 c = 627 Elapsed time is 0.404826 seconds.

9   Pass
%% n=47; exp=751; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 135 c = 295 c = 431 c = 543 c = 631 c = 695 c = 735 c = 751 Elapsed time is 0.450586 seconds.

10   Pass
%% n=53; exp=953; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 153 c = 337 c = 497 c = 633 c = 745 c = 833 c = 897 c = 937 c = 953 Elapsed time is 0.497494 seconds.

11   Pass
%% n=59; exp=1179; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 563 c = 723 c = 859 c = 971 c = 1059 c = 1123 c = 1163 c = 1179 Elapsed time is 0.543870 seconds.

12   Pass
%% n=61; exp=1257; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 585 c = 753 c = 897 c = 1017 c = 1113 c = 1185 c = 1233 c = 1257 Elapsed time is 0.589321 seconds.

13   Pass
%% n=67; exp=1515; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 1011 c = 1155 c = 1275 c = 1371 c = 1443 c = 1491 c = 1515 Elapsed time is 0.635582 seconds.

14   Pass
%% n=71; exp=1703; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 1247 c = 1383 c = 1495 c = 1583 c = 1647 c = 1687 c = 1703 Elapsed time is 0.683489 seconds.

15   Pass
%% n=73; exp=1797; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 1293 c = 1437 c = 1557 c = 1653 c = 1725 c = 1773 c = 1797 Elapsed time is 0.730886 seconds.

16   Pass
%% n=79; exp=2103; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 1743 c = 1863 c = 1959 c = 2031 c = 2079 c = 2103 Elapsed time is 0.777213 seconds.

17   Pass
%% n=83; exp=2323; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 2003 c = 2115 c = 2203 c = 2267 c = 2307 c = 2323 Elapsed time is 0.823968 seconds.

18   Pass
%% n=89; exp=2669; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 2349 c = 2461 c = 2549 c = 2613 c = 2653 c = 2669 Elapsed time is 0.869687 seconds.

19   Pass
%% n=97; exp=3165; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

c = 2925 c = 3021 c = 3093 c = 3141 c = 3165 Elapsed time is 0.916298 seconds.