Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 332259

Submitted on 10 Oct 2013 by Mark Hanus

Correct

94Size
This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Column 17
    45
c =
    85
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    80    84
  Column 17
    85
c =
   101
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    87    93    99   100
  Column 17
   101
Elapsed time is 0.085232 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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Columns 17 through 19
    46    49    51
c =
    99
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    83    90
  Columns 17 through 19
    94    98    99
c =
   123
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   109   115
  Columns 17 through 19
   121   122   123
Elapsed time is 0.160887 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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Columns 17 through 23
    46    49    52    55    58    61    63
c =
   127
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    83    90
  Columns 17 through 23
    97   104   111   118   122   126   127
c =
   167
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 23
   136   147   153   159   165   166   167
c =
   183
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 23
   156   164   172   180   181   182   183
Elapsed time is 0.213469 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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Columns 17 through 29
    46    49    52    55    58    61    64    67    70    73    76    79    81
c =
   169
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    83    90
  Columns 17 through 29
    97   104   111   118   125   132   139   146   153   160   164   168   169
c =
   233
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 29
   136   147   158   169   180   191   202   213   219   225   231   232   233
c =
   273
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 29
   163   178   193   208   223   238   246   254   262   270   271   272   273
c =
   289
possible =
  Columns 1 through 16
     0     1     2     3     4     9    18    27    36    45    64    83   102   121   140   159
  Columns 17 through 29
   178   197   216   235   245   255   265   275   285   286   287   288   289
Elapsed time is 0.266413 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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Columns 17 through 31
    46    49    52    55    58    61    64    67    70    73    76    79    82    85    87
c =
   183
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    83    90
  Columns 17 through 31
    97   104   111   118   125   132   139   146   153   160   167   174   178   182   183
c =
   255
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 31
   136   147   158   169   180   191   202   213   224   235   241   247   253   254   255
c =
   303
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 31
   163   178   193   208   223   238   253   268   276   284   292   300   301   302   303
c =
   327
possible =
  Columns 1 through 16
     0     1     2     3     4     9    18    27    36    45    64    83   102   121   140   159
  Columns 17 through 31
   178   197   216   235   254   273   283   293   303   313   323   324   325   326   327
Elapsed time is 0.316923 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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Columns 17 through 32
    46    49    52    55    58    61    64    67    70    73    76    79    82    85    88    91
  Columns 33 through 37
    94    97   100   103   105
c =
   225
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    83    90
  Columns 17 through 32
    97   104   111   118   125   132   139   146   153   160   167   174   181   188   195   202
  Columns 33 through 37
   209   216   220   224   225
c =
   321
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 32
   136   147   158   169   180   191   202   213   224   235   246   257   268   279   290   301
  Columns 33 through 37
   307   313   319   320   321
c =
   393
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 32
   163   178   193   208   223   238   253   268   283   298   313   328   343   358   366   374
  Columns 33 through 37
   382   390   391   392   393
c =
   441
possible =
  Columns 1 through 16
     0     1     2     3     4     9    18    27    36    45    64    83   102   121   140   159
  Columns 17 through 32
   178   197   216   235   254   273   292   311   330   349   368   387   397   407   417   427
  Columns 33 through 37
   437   438   439   440   441
c =
   465
possible =
  Columns 1 through 16
     0     1     2     3     4     5    11    22    33    44    55    66    89   112   135   158
  Columns 17 through 32
   181   204   227   250   273   296   319   342   365   388   400   412   424   436   448   460
  Columns 33 through 37
   461   462   463   464   465
Elapsed time is 0.369877 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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Columns 17 through 32
    46    49    52    55    58    61    64    67    70    73    76    79    82    85    88    91
  Columns 33 through 41
    94    97   100   103   106   109   112   115   117
c =
   253
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    83    90
  Columns 17 through 32
    97   104   111   118   125   132   139   146   153   160   167   174   181   188   195   202
  Columns 33 through 41
   209   216   223   230   237   244   248   252   253
c =
   365
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 32
   136   147   158   169   180   191   202   213   224   235   246   257   268   279   290   301
  Columns 33 through 41
   312   323   334   345   351   357   363   364   365
c =
   453
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 32
   163   178   193   208   223   238   253   268   283   298   313   328   343   358   373   388
  Columns 33 through 41
   403   418   426   434   442   450   451   452   453
c =
   517
possible =
  Columns 1 through 16
     0     1     2     3     4     9    18    27    36    45    64    83   102   121   140   159
  Columns 17 through 32
   178   197   216   235   254   273   292   311   330   349   368   387   406   425   444   463
  Columns 33 through 41
   473   483   493   503   513   514   515   516   517
c =
   557
possible =
  Columns 1 through 16
     0     1     2     3     4     5    11    22    33    44    55    66    89   112   135   158
  Columns 17 through 32
   181   204   227   250   273   296   319   342   365   388   411   434   457   480   492   504
  Columns 33 through 41
   516   528   540   552   553   554   555   556   557
c =
   573
possible =
  Columns 1 through 16
     0     1     2     3     4     5     6    13    26    39    52    65    78    91   118   145
  Columns 17 through 32
   172   199   226   253   280   307   334   361   388   415   442   469   483   497   511   525
  Columns 33 through 41
   539   553   567   568   569   570   571   572   573
Elapsed time is 0.420801 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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Columns 17 through 32
    46    49    52    55    58    61    64    67    70    73    76    79    82    85    88    91
  Columns 33 through 43
    94    97   100   103   106   109   112   115   118   121   123
c =
   267
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    83    90
  Columns 17 through 32
    97   104   111   118   125   132   139   146   153   160   167   174   181   188   195   202
  Columns 33 through 43
   209   216   223   230   237   244   251   258   262   266   267
c =
   387
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 32
   136   147   158   169   180   191   202   213   224   235   246   257   268   279   290   301
  Columns 33 through 43
   312   323   334   345   356   367   373   379   385   386   387
c =
   483
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 32
   163   178   193   208   223   238   253   268   283   298   313   328   343   358   373   388
  Columns 33 through 43
   403   418   433   448   456   464   472   480   481   482   483
c =
   555
possible =
  Columns 1 through 16
     0     1     2     3     4     9    18    27    36    45    64    83   102   121   140   159
  Columns 17 through 32
   178   197   216   235   254   273   292   311   330   349   368   387   406   425   444   463
  Columns 33 through 43
   482   501   511   521   531   541   551   552   553   554   555
c =
   603
possible =
  Columns 1 through 16
     0     1     2     3     4     5    11    22    33    44    55    66    89   112   135   158
  Columns 17 through 32
   181   204   227   250   273   296   319   342   365   388   411   434   457   480   503   526
  Columns 33 through 43
   538   550   562   574   586   598   599   600   601   602   603
c =
   627
possible =
  Columns 1 through 16
     0     1     2     3     4     5     6    13    26    39    52    65    78    91   118   145
  Columns 17 through 32
   172   199   226   253   280   307   334   361   388   415   442   469   496   523   537   551
  Columns 33 through 43
   565   579   593   607   621   622   623   624   625   626   627
Elapsed time is 0.471586 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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Columns 17 through 32
    46    49    52    55    58    61    64    67    70    73    76    79    82    85    88    91
  Columns 33 through 47
    94    97   100   103   106   109   112   115   118   121   124   127   130   133   135
c =
   295
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    83    90
  Columns 17 through 32
    97   104   111   118   125   132   139   146   153   160   167   174   181   188   195   202
  Columns 33 through 47
   209   216   223   230   237   244   251   258   265   272   279   286   290   294   295
c =
   431
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 32
   136   147   158   169   180   191   202   213   224   235   246   257   268   279   290   301
  Columns 33 through 47
   312   323   334   345   356   367   378   389   400   411   417   423   429   430   431
c =
   543
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 32
   163   178   193   208   223   238   253   268   283   298   313   328   343   358   373   388
  Columns 33 through 47
   403   418   433   448   463   478   493   508   516   524   532   540   541   542   543
c =
   631
possible =
  Columns 1 through 16
     0     1     2     3     4     9    18    27    36    45    64    83   102   121   140   159
  Columns 17 through 32
   178   197   216   235   254   273   292   311   330   349   368   387   406   425   444   463
  Columns 33 through 47
   482   501   520   539   558   577   587   597   607   617   627   628   629   630   631
c =
   695
possible =
  Columns 1 through 16
     0     1     2     3     4     5    11    22    33    44    55    66    89   112   135   158
  Columns 17 through 32
   181   204   227   250   273   296   319   342   365   388   411   434   457   480   503   526
  Columns 33 through 47
   549   572   595   618   630   642   654   666   678   690   691   692   693   694   695
c =
   735
possible =
  Columns 1 through 16
     0     1     2     3     4     5     6    13    26    39    52    65    78    91   118   145
  Columns 17 through 32
   172   199   226   253   280   307   334   361   388   415   442   469   496   523   550   577
  Columns 33 through 47
   604   631   645   659   673   687   701   715   729   730   731   732   733   734   735
c =
   751
possible =
  Columns 1 through 16
     0     1     2     3     4     5     6     7    15    30    45    60    75    90   105   120
  Columns 17 through 32
   151   182   213   244   275   306   337   368   399   430   461   492   523   554   585   616
  Columns 33 through 47
   632   648   664   680   696   712   728   744   745   746   747   748   749   750   751
Elapsed time is 0.522016 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
possible =
  Columns 1 through 16
     0     1     4     7    10    13    16    19    22    25    28    31    34    37    40    43
  Columns 17 through 32
    46    49    52    55    58    61    64    67    70    73    76    79    82    85    88    91
  Columns 33 through 48
    94    97   100   103   106   109   112   115   118   121   124   127   130   133   136   139
  Columns 49 through 53
   142   145   148   151   153
c =
   337
possible =
  Columns 1 through 16
     0     1     3     6    13    20    27    34    41    48    55    62    69    76    83    90
  Columns 17 through 32
    97   104   111   118   125   132   139   146   153   160   167   174   181   188   195   202
  Columns 33 through 48
   209   216   223   230   237   244   251   258   265   272   279   286   293   300   307   314
  Columns 49 through 53
   321   328   332   336   337
c =
   497
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 32
   136   147   158   169   180   191   202   213   224   235   246   257   268   279   290   301
  Columns 33 through 48
   312   323   334   345   356   367   378   389   400   411   422   433   444   455   466   477
  Columns 49 through 53
   483   489   495   496   497
c =
   633
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 32
   163   178   193   208   223   238   253   268   283   298   313   328   343   358   373   388
  Columns 33 through 48
   403   418   433   448   463   478   493   508   523   538   553   568   583   598   606   614
  Columns 49 through 53
   622   630   631   632   633
c =
   745
possible =
  Columns 1 through 16
     0     1     2     3     4     9    18    27    36    45    64    83   102   121   140   159
  Columns 17 through 32
   178   197   216   235   254   273   292   311   330   349   368   387   406   425   444   463
  Columns 33 through 48
   482   501   520   539   558   577   596   615   634   653   672   691   701   711   721   731
  Columns 49 through 53
   741   742   743   744   745
c =
   833
possible =
  Columns 1 through 16
     0     1     2     3     4     5    11    22    33    44    55    66    89   112   135   158
  Columns 17 through 32
   181   204   227   250   273   296   319   342   365   388   411   434   457   480   503   526
  Columns 33 through 48
   549   572   595   618   641   664   687   710   733   756   768   780   792   804   816   828
  Columns 49 through 53
   829   830   831   832   833
c =
   897
possible =
  Columns 1 through 16
     0     1     2     3     4     5     6    13    26    39    52    65    78    91   118   145
  Columns 17 through 32
   172   199   226   253   280   307   334   361   388   415   442   469   496   523   550   577
  Columns 33 through 48
   604   631   658   685   712   739   766   793   807   821   835   849   863   877   891   892
  Columns 49 through 53
   893   894   895   896   897
c =
   937
possible =
  Columns 1 through 16
     0     1     2     3     4     5     6     7    15    30    45    60    75    90   105   120
  Columns 17 through 32
   151   182   213   244   275   306   337   368   399   430   461   492   523   554   585   616
  Columns 33 through 48
   647   678   709   740   771   802   818   834   850   866   882   898   914   930   931   932
  Columns 49 through 53
   933   934   935   936   937
c =
   953
possible =
  Columns 1 through 16
     0     1     2     3     4     5     6     7     8    17    34    51    68    85   102   119
  Columns 17 through 32
   136   153   188   223   258   293   328   363   398   433   468   503   538   573   608   643
  Columns 33 through 48
   678   713   748   783   801   819   837   855   873   891   909   927   945   946   947   948
  Columns 49 through 53
   949   950   951   952   953
Elapsed time is 0.576477 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
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 32
   136   147   158   169   180   191   202   213   224   235   246   257   268   279   290   301
  Columns 33 through 48
   312   323   334   345   356   367   378   389   400   411   422   433   444   455   466   477
  Columns 49 through 59
   488   499   510   521   532   543   549   555   561   562   563
c =
   723
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 32
   163   178   193   208   223   238   253   268   283   298   313   328   343   358   373   388
  Columns 33 through 48
   403   418   433   448   463   478   493   508   523   538   553   568   583   598   613   628
  Columns 49 through 59
   643   658   673   688   696   704   712   720   721   722   723
c =
   859
possible =
  Columns 1 through 16
     0     1     2     3     4     9    18    27    36    45    64    83   102   121   140   159
  Columns 17 through 32
   178   197   216   235   254   273   292   311   330   349   368   387   406   425   444   463
  Columns 33 through 48
   482   501   520   539   558   577   596   615   634   653   672   691   710   729   748   767
  Columns 49 through 59
   786   805   815   825   835   845   855   856   857   858   859
c =
   971
possible =
  Columns 1 through 16
     0     1     2     3     4     5    11    22    33    44    55    66    89   112   135   158
  Columns 17 through 32
   181   204   227   250   273   296   319   342   365   388   411   434   457   480   503   526
  Columns 33 through 48
   549   572   595   618   641   664   687   710   733   756   779   802   825   848   871   894
  Columns 49 through 59
   906   918   930   942   954   966   967   968   969   970   971
c =
        1059
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6          13
  Columns 9 through 16
          26          39          52          65          78          91         118         145
  Columns 17 through 24
         172         199         226         253         280         307         334         361
  Columns 25 through 32
         388         415         442         469         496         523         550         577
  Columns 33 through 40
         604         631         658         685         712         739         766         793
  Columns 41 through 48
         820         847         874         901         928         955         969         983
  Columns 49 through 56
         997        1011        1025        1039        1053        1054        1055        1056
  Columns 57 through 59
        1057        1058        1059
c =
        1123
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
          15          30          45          60          75          90         105         120
  Columns 17 through 24
         151         182         213         244         275         306         337         368
  Columns 25 through 32
         399         430         461         492         523         554         585         616
  Columns 33 through 40
         647         678         709         740         771         802         833         864
  Columns 41 through 48
         895         926         957         988        1004        1020        1036        1052
  Columns 49 through 56
        1068        1084        1100        1116        1117        1118        1119        1120
  Columns 57 through 59
        1121        1122        1123
c =
        1163
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8          17          34          51          68          85         102         119
  Columns 17 through 24
         136         153         188         223         258         293         328         363
  Columns 25 through 32
         398         433         468         503         538         573         608         643
  Columns 33 through 40
         678         713         748         783         818         853         888         923
  Columns 41 through 48
         958         993        1011        1029        1047        1065        1083        1101
  Columns 49 through 56
        1119        1137        1155        1156        1157        1158        1159        1160
  Columns 57 through 59
        1161        1162        1163
c =
        1179
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          19          38          57          76          95         114
  Columns 17 through 24
         133         152         171         190         229         268         307         346
  Columns 25 through 32
         385         424         463         502         541         580         619         658
  Columns 33 through 40
         697         736         775         814         853         892         931         970
  Columns 41 through 48
         990        1010        1030        1050        1070        1090        1110        1130
  Columns 49 through 56
        1150        1170        1171        1172        1173        1174        1175        1176
  Columns 57 through 59
        1177        1178        1179
Elapsed time is 0.630442 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
possible =
  Columns 1 through 16
     0     1     2     5    10    15    26    37    48    59    70    81    92   103   114   125
  Columns 17 through 32
   136   147   158   169   180   191   202   213   224   235   246   257   268   279   290   301
  Columns 33 through 48
   312   323   334   345   356   367   378   389   400   411   422   433   444   455   466   477
  Columns 49 through 61
   488   499   510   521   532   543   554   565   571   577   583   584   585
c =
   753
possible =
  Columns 1 through 16
     0     1     2     3     7    14    21    28    43    58    73    88   103   118   133   148
  Columns 17 through 32
   163   178   193   208   223   238   253   268   283   298   313   328   343   358   373   388
  Columns 33 through 48
   403   418   433   448   463   478   493   508   523   538   553   568   583   598   613   628
  Columns 49 through 61
   643   658   673   688   703   718   726   734   742   750   751   752   753
c =
   897
possible =
  Columns 1 through 16
     0     1     2     3     4     9    18    27    36    45    64    83   102   121   140   159
  Columns 17 through 32
   178   197   216   235   254   273   292   311   330   349   368   387   406   425   444   463
  Columns 33 through 48
   482   501   520   539   558   577   596   615   634   653   672   691   710   729   748   767
  Columns 49 through 61
   786   805   824   843   853   863   873   883   893   894   895   896   897
c =
        1017
possible =
  Columns 1 through 8
           0           1           2           3           4           5          11          22
  Columns 9 through 16
          33          44          55          66          89         112         135         158
  Columns 17 through 24
         181         204         227         250         273         296         319         342
  Columns 25 through 32
         365         388         411         434         457         480         503         526
  Columns 33 through 40
         549         572         595         618         641         664         687         710
  Columns 41 through 48
         733         756         779         802         825         848         871         894
  Columns 49 through 56
         917         940         952         964         976         988        1000        1012
  Columns 57 through 61
        1013        1014        1015        1016        1017
c =
        1113
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6          13
  Columns 9 through 16
          26          39          52          65          78          91         118         145
  Columns 17 through 24
         172         199         226         253         280         307         334         361
  Columns 25 through 32
         388         415         442         469         496         523         550         577
  Columns 33 through 40
         604         631         658         685         712         739         766         793
  Columns 41 through 48
         820         847         874         901         928         955         982        1009
  Columns 49 through 56
        1023        1037        1051        1065        1079        1093        1107        1108
  Columns 57 through 61
        1109        1110        1111        1112        1113
c =
        1185
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
          15          30          45          60          75          90         105         120
  Columns 17 through 24
         151         182         213         244         275         306         337         368
  Columns 25 through 32
         399         430         461         492         523         554         585         616
  Columns 33 through 40
         647         678         709         740         771         802         833         864
  Columns 41 through 48
         895         926         957         988        1019        1050        1066        1082
  Columns 49 through 56
        1098        1114        1130        1146        1162        1178        1179        1180
  Columns 57 through 61
        1181        1182        1183        1184        1185
c =
        1233
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8          17          34          51          68          85         102         119
  Columns 17 through 24
         136         153         188         223         258         293         328         363
  Columns 25 through 32
         398         433         468         503         538         573         608         643
  Columns 33 through 40
         678         713         748         783         818         853         888         923
  Columns 41 through 48
         958         993        1028        1063        1081        1099        1117        1135
  Columns 49 through 56
        1153        1171        1189        1207        1225        1226        1227        1228
  Columns 57 through 61
        1229        1230        1231        1232        1233
c =
        1257
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          19          38          57          76          95         114
  Columns 17 through 24
         133         152         171         190         229         268         307         346
  Columns 25 through 32
         385         424         463         502         541         580         619         658
  Columns 33 through 40
         697         736         775         814         853         892         931         970
  Columns 41 through 48
        1009        1048        1068        1088        1108        1128        1148        1168
  Columns 49 through 56
        1188        1208        1228        1248        1249        1250        1251        1252
  Columns 57 through 61
        1253        1254        1255        1256        1257
Elapsed time is 0.685817 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
possible =
  Columns 1 through 8
           0           1           2           3           4           9          18          27
  Columns 9 through 16
          36          45          64          83         102         121         140         159
  Columns 17 through 24
         178         197         216         235         254         273         292         311
  Columns 25 through 32
         330         349         368         387         406         425         444         463
  Columns 33 through 40
         482         501         520         539         558         577         596         615
  Columns 41 through 48
         634         653         672         691         710         729         748         767
  Columns 49 through 56
         786         805         824         843         862         881         900         919
  Columns 57 through 64
         938         957         967         977         987         997        1007        1008
  Columns 65 through 67
        1009        1010        1011
c =
        1155
possible =
  Columns 1 through 8
           0           1           2           3           4           5          11          22
  Columns 9 through 16
          33          44          55          66          89         112         135         158
  Columns 17 through 24
         181         204         227         250         273         296         319         342
  Columns 25 through 32
         365         388         411         434         457         480         503         526
  Columns 33 through 40
         549         572         595         618         641         664         687         710
  Columns 41 through 48
         733         756         779         802         825         848         871         894
  Columns 49 through 56
         917         940         963         986        1009        1032        1055        1078
  Columns 57 through 64
        1090        1102        1114        1126        1138        1150        1151        1152
  Columns 65 through 67
        1153        1154        1155
c =
        1275
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6          13
  Columns 9 through 16
          26          39          52          65          78          91         118         145
  Columns 17 through 24
         172         199         226         253         280         307         334         361
  Columns 25 through 32
         388         415         442         469         496         523         550         577
  Columns 33 through 40
         604         631         658         685         712         739         766         793
  Columns 41 through 48
         820         847         874         901         928         955         982        1009
  Columns 49 through 56
        1036        1063        1090        1117        1144        1171        1185        1199
  Columns 57 through 64
        1213        1227        1241        1255        1269        1270        1271        1272
  Columns 65 through 67
        1273        1274        1275
c =
        1371
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
          15          30          45          60          75          90         105         120
  Columns 17 through 24
         151         182         213         244         275         306         337         368
  Columns 25 through 32
         399         430         461         492         523         554         585         616
  Columns 33 through 40
         647         678         709         740         771         802         833         864
  Columns 41 through 48
         895         926         957         988        1019        1050        1081        1112
  Columns 49 through 56
        1143        1174        1205        1236        1252        1268        1284        1300
  Columns 57 through 64
        1316        1332        1348        1364        1365        1366        1367        1368
  Columns 65 through 67
        1369        1370        1371
c =
        1443
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8          17          34          51          68          85         102         119
  Columns 17 through 24
         136         153         188         223         258         293         328         363
  Columns 25 through 32
         398         433         468         503         538         573         608         643
  Columns 33 through 40
         678         713         748         783         818         853         888         923
  Columns 41 through 48
         958         993        1028        1063        1098        1133        1168        1203
  Columns 49 through 56
        1238        1273        1291        1309        1327        1345        1363        1381
  Columns 57 through 64
        1399        1417        1435        1436        1437        1438        1439        1440
  Columns 65 through 67
        1441        1442        1443
c =
        1491
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          19          38          57          76          95         114
  Columns 17 through 24
         133         152         171         190         229         268         307         346
  Columns 25 through 32
         385         424         463         502         541         580         619         658
  Columns 33 through 40
         697         736         775         814         853         892         931         970
  Columns 41 through 48
        1009        1048        1087        1126        1165        1204        1243        1282
  Columns 49 through 56
        1302        1322        1342        1362        1382        1402        1422        1442
  Columns 57 through 64
        1462        1482        1483        1484        1485        1486        1487        1488
  Columns 65 through 67
        1489        1490        1491
c =
        1515
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          10          21          42          63          84         105
  Columns 17 through 24
         126         147         168         189         210         231         274         317
  Columns 25 through 32
         360         403         446         489         532         575         618         661
  Columns 33 through 40
         704         747         790         833         876         919         962        1005
  Columns 41 through 48
        1048        1091        1134        1177        1220        1263        1285        1307
  Columns 49 through 56
        1329        1351        1373        1395        1417        1439        1461        1483
  Columns 57 through 64
        1505        1506        1507        1508        1509        1510        1511        1512
  Columns 65 through 67
        1513        1514        1515
Elapsed time is 0.741968 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
possible =
  Columns 1 through 8
           0           1           2           3           4           5          11          22
  Columns 9 through 16
          33          44          55          66          89         112         135         158
  Columns 17 through 24
         181         204         227         250         273         296         319         342
  Columns 25 through 32
         365         388         411         434         457         480         503         526
  Columns 33 through 40
         549         572         595         618         641         664         687         710
  Columns 41 through 48
         733         756         779         802         825         848         871         894
  Columns 49 through 56
         917         940         963         986        1009        1032        1055        1078
  Columns 57 through 64
        1101        1124        1147        1170        1182        1194        1206        1218
  Columns 65 through 71
        1230        1242        1243        1244        1245        1246        1247
c =
        1383
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6          13
  Columns 9 through 16
          26          39          52          65          78          91         118         145
  Columns 17 through 24
         172         199         226         253         280         307         334         361
  Columns 25 through 32
         388         415         442         469         496         523         550         577
  Columns 33 through 40
         604         631         658         685         712         739         766         793
  Columns 41 through 48
         820         847         874         901         928         955         982        1009
  Columns 49 through 56
        1036        1063        1090        1117        1144        1171        1198        1225
  Columns 57 through 64
        1252        1279        1293        1307        1321        1335        1349        1363
  Columns 65 through 71
        1377        1378        1379        1380        1381        1382        1383
c =
        1495
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
          15          30          45          60          75          90         105         120
  Columns 17 through 24
         151         182         213         244         275         306         337         368
  Columns 25 through 32
         399         430         461         492         523         554         585         616
  Columns 33 through 40
         647         678         709         740         771         802         833         864
  Columns 41 through 48
         895         926         957         988        1019        1050        1081        1112
  Columns 49 through 56
        1143        1174        1205        1236        1267        1298        1329        1360
  Columns 57 through 64
        1376        1392        1408        1424        1440        1456        1472        1488
  Columns 65 through 71
        1489        1490        1491        1492        1493        1494        1495
c =
        1583
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8          17          34          51          68          85         102         119
  Columns 17 through 24
         136         153         188         223         258         293         328         363
  Columns 25 through 32
         398         433         468         503         538         573         608         643
  Columns 33 through 40
         678         713         748         783         818         853         888         923
  Columns 41 through 48
         958         993        1028        1063        1098        1133        1168        1203
  Columns 49 through 56
        1238        1273        1308        1343        1378        1413        1431        1449
  Columns 57 through 64
        1467        1485        1503        1521        1539        1557        1575        1576
  Columns 65 through 71
        1577        1578        1579        1580        1581        1582        1583
c =
        1647
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          19          38          57          76          95         114
  Columns 17 through 24
         133         152         171         190         229         268         307         346
  Columns 25 through 32
         385         424         463         502         541         580         619         658
  Columns 33 through 40
         697         736         775         814         853         892         931         970
  Columns 41 through 48
        1009        1048        1087        1126        1165        1204        1243        1282
  Columns 49 through 56
        1321        1360        1399        1438        1458        1478        1498        1518
  Columns 57 through 64
        1538        1558        1578        1598        1618        1638        1639        1640
  Columns 65 through 71
        1641        1642        1643        1644        1645        1646        1647
c =
        1687
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          10          21          42          63          84         105
  Columns 17 through 24
         126         147         168         189         210         231         274         317
  Columns 25 through 32
         360         403         446         489         532         575         618         661
  Columns 33 through 40
         704         747         790         833         876         919         962        1005
  Columns 41 through 48
        1048        1091        1134        1177        1220        1263        1306        1349
  Columns 49 through 56
        1392        1435        1457        1479        1501        1523        1545        1567
  Columns 57 through 64
        1589        1611        1633        1655        1677        1678        1679        1680
  Columns 65 through 71
        1681        1682        1683        1684        1685        1686        1687
c =
        1703
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          10          11          23          46          69          92
  Columns 17 through 24
         115         138         161         184         207         230         253         276
  Columns 25 through 32
         323         370         417         464         511         558         605         652
  Columns 33 through 40
         699         746         793         840         887         934         981        1028
  Columns 41 through 48
        1075        1122        1169        1216        1263        1310        1357        1404
  Columns 49 through 56
        1428        1452        1476        1500        1524        1548        1572        1596
  Columns 57 through 64
        1620        1644        1668        1692        1693        1694        1695        1696
  Columns 65 through 71
        1697        1698        1699        1700        1701        1702        1703
Elapsed time is 0.798753 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
possible =
  Columns 1 through 8
           0           1           2           3           4           5          11          22
  Columns 9 through 16
          33          44          55          66          89         112         135         158
  Columns 17 through 24
         181         204         227         250         273         296         319         342
  Columns 25 through 32
         365         388         411         434         457         480         503         526
  Columns 33 through 40
         549         572         595         618         641         664         687         710
  Columns 41 through 48
         733         756         779         802         825         848         871         894
  Columns 49 through 56
         917         940         963         986        1009        1032        1055        1078
  Columns 57 through 64
        1101        1124        1147        1170        1193        1216        1228        1240
  Columns 65 through 72
        1252        1264        1276        1288        1289        1290        1291        1292
  Column 73
        1293
c =
        1437
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6          13
  Columns 9 through 16
          26          39          52          65          78          91         118         145
  Columns 17 through 24
         172         199         226         253         280         307         334         361
  Columns 25 through 32
         388         415         442         469         496         523         550         577
  Columns 33 through 40
         604         631         658         685         712         739         766         793
  Columns 41 through 48
         820         847         874         901         928         955         982        1009
  Columns 49 through 56
        1036        1063        1090        1117        1144        1171        1198        1225
  Columns 57 through 64
        1252        1279        1306        1333        1347        1361        1375        1389
  Columns 65 through 72
        1403        1417        1431        1432        1433        1434        1435        1436
  Column 73
        1437
c =
        1557
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
          15          30          45          60          75          90         105         120
  Columns 17 through 24
         151         182         213         244         275         306         337         368
  Columns 25 through 32
         399         430         461         492         523         554         585         616
  Columns 33 through 40
         647         678         709         740         771         802         833         864
  Columns 41 through 48
         895         926         957         988        1019        1050        1081        1112
  Columns 49 through 56
        1143        1174        1205        1236        1267        1298        1329        1360
  Columns 57 through 64
        1391        1422        1438        1454        1470        1486        1502        1518
  Columns 65 through 72
        1534        1550        1551        1552        1553        1554        1555        1556
  Column 73
        1557
c =
        1653
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8          17          34          51          68          85         102         119
  Columns 17 through 24
         136         153         188         223         258         293         328         363
  Columns 25 through 32
         398         433         468         503         538         573         608         643
  Columns 33 through 40
         678         713         748         783         818         853         888         923
  Columns 41 through 48
         958         993        1028        1063        1098        1133        1168        1203
  Columns 49 through 56
        1238        1273        1308        1343        1378        1413        1448        1483
  Columns 57 through 64
        1501        1519        1537        1555        1573        1591        1609        1627
  Columns 65 through 72
        1645        1646        1647        1648        1649        1650        1651        1652
  Column 73
        1653
c =
        1725
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          19          38          57          76          95         114
  Columns 17 through 24
         133         152         171         190         229         268         307         346
  Columns 25 through 32
         385         424         463         502         541         580         619         658
  Columns 33 through 40
         697         736         775         814         853         892         931         970
  Columns 41 through 48
        1009        1048        1087        1126        1165        1204        1243        1282
  Columns 49 through 56
        1321        1360        1399        1438        1477        1516        1536        1556
  Columns 57 through 64
        1576        1596        1616        1636        1656        1676        1696        1716
  Columns 65 through 72
        1717        1718        1719        1720        1721        1722        1723        1724
  Column 73
        1725
c =
        1773
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          10          21          42          63          84         105
  Columns 17 through 24
         126         147         168         189         210         231         274         317
  Columns 25 through 32
         360         403         446         489         532         575         618         661
  Columns 33 through 40
         704         747         790         833         876         919         962        1005
  Columns 41 through 48
        1048        1091        1134        1177        1220        1263        1306        1349
  Columns 49 through 56
        1392        1435        1478        1521        1543        1565        1587        1609
  Columns 57 through 64
        1631        1653        1675        1697        1719        1741        1763        1764
  Columns 65 through 72
        1765        1766        1767        1768        1769        1770        1771        1772
  Column 73
        1773
c =
        1797
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          10          11          23          46          69          92
  Columns 17 through 24
         115         138         161         184         207         230         253         276
  Columns 25 through 32
         323         370         417         464         511         558         605         652
  Columns 33 through 40
         699         746         793         840         887         934         981        1028
  Columns 41 through 48
        1075        1122        1169        1216        1263        1310        1357        1404
  Columns 49 through 56
        1451        1498        1522        1546        1570        1594        1618        1642
  Columns 57 through 64
        1666        1690        1714        1738        1762        1786        1787        1788
  Columns 65 through 72
        1789        1790        1791        1792        1793        1794        1795        1796
  Column 73
        1797
Elapsed time is 0.855753 seconds.
16
Fail
 
%%
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
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
          15          30          45          60          75          90         105         120
  Columns 17 through 24
         151         182         213         244         275         306         337         368
  Columns 25 through 32
         399         430         461         492         523         554         585         616
  Columns 33 through 40
         647         678         709         740         771         802         833         864
  Columns 41 through 48
         895         926         957         988        1019        1050        1081        1112
  Columns 49 through 56
        1143        1174        1205        1236        1267        1298        1329        1360
  Columns 57 through 64
        1391        1422        1453        1484        1515        1546        1577        1608
  Columns 65 through 72
        1624        1640        1656        1672        1688        1704        1720        1736
  Columns 73 through 79
        1737        1738        1739        1740        1741        1742        1743
c =
        1863
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8          17          34          51          68          85         102         119
  Columns 17 through 24
         136         153         188         223         258         293         328         363
  Columns 25 through 32
         398         433         468         503         538         573         608         643
  Columns 33 through 40
         678         713         748         783         818         853         888         923
  Columns 41 through 48
         958         993        1028        1063        1098        1133        1168        1203
  Columns 49 through 56
        1238        1273        1308        1343        1378        1413        1448        1483
  Columns 57 through 64
        1518        1553        1588        1623        1658        1693        1711        1729
  Columns 65 through 72
        1747        1765        1783        1801        1819        1837        1855        1856
  Columns 73 through 79
        1857        1858        1859        1860        1861        1862        1863
c =
        1959
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          19          38          57          76          95         114
  Columns 17 through 24
         133         152         171         190         229         268         307         346
  Columns 25 through 32
         385         424         463         502         541         580         619         658
  Columns 33 through 40
         697         736         775         814         853         892         931         970
  Columns 41 through 48
        1009        1048        1087        1126        1165        1204        1243        1282
  Columns 49 through 56
        1321        1360        1399        1438        1477        1516        1555        1594
  Columns 57 through 64
        1633        1672        1711        1750        1770        1790        1810        1830
  Columns 65 through 72
        1850        1870        1890        1910        1930        1950        1951        1952
  Columns 73 through 79
        1953        1954        1955        1956        1957        1958        1959
c =
        2031
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          10          21          42          63          84         105
  Columns 17 through 24
         126         147         168         189         210         231         274         317
  Columns 25 through 32
         360         403         446         489         532         575         618         661
  Columns 33 through 40
         704         747         790         833         876         919         962        1005
  Columns 41 through 48
        1048        1091        1134        1177        1220        1263        1306        1349
  Columns 49 through 56
        1392        1435        1478        1521        1564        1607        1650        1693
  Columns 57 through 64
        1736        1779        1801        1823        1845        1867        1889        1911
  Columns 65 through 72
        1933        1955        1977        1999        2021        2022        2023        2024
  Columns 73 through 79
        2025        2026        2027        2028        2029        2030        2031
c =
        2079
possible =
  Columns 1 through 8
           0           1           2           3           4           5           6           7
  Columns 9 through 16
           8           9          10          11          23          46          69          92
  Columns 17 through 24
         115         138         161         184         207         230         253         276
  Columns 25 through 32
         323