Cody

# Problem 44341. Hexagonal numbers on a spiral matrix

Solution 1330565

Submitted on 7 Nov 2017
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
m = 1; y_correct = '1'; assert(isequal(hexagonalSpiral(m),y_correct))

2   Pass
m = 2; y_correct = '16'; assert(isequal(hexagonalSpiral(m),y_correct))

3   Pass
m = 5; y_correct = '1293'; assert(isequal(hexagonalSpiral(m),y_correct))

4   Pass
m = 16; y_correct = '420800'; assert(isequal(hexagonalSpiral(m),y_correct))

5   Pass
m = 100; y_correct = '4000333360'; assert(isequal(hexagonalSpiral(m),y_correct))

6   Pass
m = 1295; y_correct = '1456830580539887'; assert(isequal(hexagonalSpiral(m),y_correct))

7   Pass
m = 2500; y_correct = '39062505208334000'; assert(isequal(hexagonalSpiral(m),y_correct))

8   Fail
m = 5000; y_correct = '1250000041666668000'; assert(isequal(hexagonalSpiral(m),y_correct))

Assertion failed.

9   Fail
m = 8000; y_correct = '13107200170666668800'; assert(isequal(hexagonalSpiral(m),y_correct))

Assertion failed.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
{"ft_lang_label":"__label__en","ft_lang_prob":0.6300102,"math_prob":0.9915954,"size":1642,"snap":"2020-45-2020-50","text_gpt3_token_len":501,"char_repetition_ratio":0.1978022,"word_repetition_ratio":0.0,"special_character_ratio":0.3733252,"punctuation_ratio":0.14440434,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9979555,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-24T18:39:57Z\",\"WARC-Record-ID\":\"<urn:uuid:b58a68e4-28e3-48d6-b517-17be79f1197d>\",\"Content-Length\":\"88913\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8c801ea7-97a5-4f70-97f8-8e07ca7edf83>\",\"WARC-Concurrent-To\":\"<urn:uuid:fe29c40f-c8c6-4167-9a11-bf59161503b7>\",\"WARC-IP-Address\":\"23.223.252.57\",\"WARC-Target-URI\":\"https://la.mathworks.com/matlabcentral/cody/problems/44341-hexagonal-numbers-on-a-spiral-matrix/solutions/1330565\",\"WARC-Payload-Digest\":\"sha1:4GOB7QAWSANGVVWPEDWLRIYSD63QZWV2\",\"WARC-Block-Digest\":\"sha1:NI6RIWPLZYFA5Q2GY4K6T5E6KJPBXIGJ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141176922.14_warc_CC-MAIN-20201124170142-20201124200142-00533.warc.gz\"}"}