Cody

# Problem 83. Prime factor digits

Solution 1888656

Submitted on 31 Jul 2019
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 = 2; p_correct = 1; assert(isequal(factor_digits(n),p_correct))

a = 2 p = 1 r = 0 a = 1

2   Fail
n = 26; p_correct = [1 0 0 0 0 1]; assert(isequal(factor_digits(n),p_correct))

a = 2 3 5 7 11 13 17 19 23 p = 9 r = 0 a = 1 3 5 7 11 13 17 19 23 r = 2 a = 1 0 5 7 11 13 17 19 23 p = 23 19 17 13 11 7 5 0 1 r = 1 a = 1 0 0 7 11 13 17 19 23 p = 23 19 17 13 11 7 0 0 1 r = 5 a = 1 0 0 0 11 13 17 19 23 p = 23 19 17 13 11 0 0 0 1 r = 4 a = 1 0 0 0 0 13 17 19 23 p = 23 19 17 13 0 0 0 0 1 r = 0 a = 1 0 0 0 0 1 17 19 23 r = 9 a = 1 0 0 0 0 1 0 19 23 p = 23 19 0 1 0 0 0 0 1 r = 7 a = 1 0 0 0 0 1 0 0 23 p = 23 0 0 1 0 0 0 0 1 r = 3 a = 1 0 0 0 0 1 0 0 0 p = 0 0 0 1 0 0 0 0 1

Assertion failed.

3   Fail
n = 168; p_correct = [1 0 1 3]; assert(isequal(factor_digits(n),p_correct))

a = Columns 1 through 30 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = 39 r = 0 a = Columns 1 through 30 1 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 r = 0 a = Columns 1 through 30 1 1 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 r = 3 a = Columns 1 through 30 1 1 0 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 Columns 31 through 39 23 19 17 13 11 7 0 1 1 r = 0 a = Columns 1 through 30 1 1 0 1 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 r = 3 a = Columns 1 through 30 1 1 0 1 0 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 Columns 31 through 39 23 19 17 13 0 1 0 1 1 r = 12 a = Columns 1 through 30 1 1 0 1 0 0 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 Columns 31 through 39 23 19 17 0 0 1 0 1 1 r = 15 a = Columns 1 through 30 1 1 0 1 0 0 0 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 Columns 31 through 39 23 19 0 0 0 1 0 1 1 r = 16 a = Columns 1 through 30 1 1 0 1 0 0 0 0 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 Columns 31 through 39 23 0 0 0 0 1 0 1 1 r = 7 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 Columns 31 through 39 0 0 0 0 0 1 0 1 1 r = 23 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 0 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 0 Columns 31 through 39 0 0 0 0 0 1 0 1 1 r = 13 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 0 0 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 0 0 Columns 31 through 39 0 0 0 0 0 1 0 1 1 r = 20 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 0 0 0 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 0 0 0 Columns 31 through 39 0 0 0 0 0 1 0 1 1 r = 4 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 0 0 0 0 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 0 0 0 0 Columns 31 through 39 0 0 0 0 0 1 0 1 1 r = 39 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 0 0 0 0 0 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 0 0 0 0 0 Columns 31 through 39 0 0 0 0 0 1 0 1 1 r = 27 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 0 0 0 0 0 0 Columns 31 through 39 0 0 0 0 0 1 0 1 1 r = 9 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 0 0 0 0 0 0 0 Columns 31 through 39 0 0 0 0 0 1 0 1 1 r = 50 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 0 0 0 0 0 0 0 0 Columns 31 through 39 0 0 0 0 0 1 0 1 1 r = 46 a = Columns 1 through 30 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 39 127 131 137 139 149 151 157 163 167 p = Columns 1 through 30 167 163 157 151 149 139...

Assertion failed.

4   Fail
n = 999; p_correct = [1 0 0 0 0 0 0 0 0 0 3 0]; assert(isequal(factor_digits(n),p_correct))

a = Columns 1 through 30 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 60 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 Columns 61 through 90 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 Columns 91 through 120 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 Columns 121 through 150 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 Columns 151 through 168 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997 p = 168 r = 1 a = Columns 1 through 30 0 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 60 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 Columns 61 through 90 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 Columns 91 through 120 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 Columns 121 through 150 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 Columns 151 through 168 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997 p = Columns 1 through 30 997 991 983 977 971 967 953 947 941 937 929 919 911 907 887 883 881 877 863 859 857 853 839 829 827 823 821 811 809 797 Columns 31 through 60 787 773 769 761 757 751 743 739 733 727 719 709 701 691 683 677 673 661 659 653 647 643 641 631 619 617 613 607 601 599 Columns 61 through 90 593 587 577 571 569 563 557 547 541 523 521 509 503 499 491 487 479 467 463 461 457 449 443 439 433 431 421 419 409 401 Columns 91 through 120 397 389 383 379 373 367 359 353 349 347 337 331 317 313 311 307 293 283 281 277 271 269 263 257 251 241 239 233 229 227 Columns 121 through 150 223 211 199 197 193 191 181 179 173 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 Columns 151 through 168 61 59 53 47 43 41 37 31 29 23 19 17 13 11 7 5 3 0 r = 0 a = Columns 1 through 30 0 1 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 60 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 Columns 61 through 90 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 Columns 91 through 120 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 Columns 121 through 150 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 Columns 151 through 168 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997 r = 4 a = Columns 1 through 30 0 1 0 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 60 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 Columns 61 through 90 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 Columns 91 through 120 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 Columns 121 through 150 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 Columns 151 through 168 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997 p = Columns 1 through 30 997 991 983 977 971 967 953 947 941 937 929 919 911 907 887 883 881 877 863 859 857 853 839 829 827 823 821 811 809 797 Columns 31 through 60 787 773 769 761 757 751 743 739 733 727 719 709 701 691 683 677 673 661 659 653 647 643 641 631 619 617 613 607 601 599 Columns 61 through 90 593 587 577 571 569 563 557 547 541 523 521 509 503 499 491 487 479 467 463 461 457 449 443 439 433 431 421 419 409 401 Columns 91 through 120 397 389 383 379 373 367 359 353 349 347 337 331 317 313 311 307 293 283 281 277 271 269 263 257 251 241 239 233 229 227 Columns 121 through 150 223 211 199 197 193 191 181 179 173 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 Columns 151 through 168 61 59 53 47 43 41 37 31 29 23 19 17 13 11 7 0 1 0 r = 5 a = Columns 1 through 30 0 1 0 0 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 60 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 Columns 61 through 90 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 Columns 91 through 120 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 Columns 121 through 150 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 Columns 151 through 168 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997 p = Columns 1 through 30 997 991 983 977 971 967 953 947 941 937 929 919 911 907 887 883 881 877 863 859 857 853 839 829 827 823 821 811 809 797 Columns 31 through 60 787 773 769 761 757 751 743 739 733 727 719 709 701 691 683 677 673 661 659 653 647 643 641 631 619 617 613 607 601 599 Columns 61 through 90 593 587 577 571 569 563 557 547 541 523 521 509 503 499 491 487 479 467 463 461 457 449 443 439 433 431 421 419 409 401 Columns 91 through 120 397 389 383 379 373 367 359 353 349 347 337 331 317 313 311 307 293 283 281 277 271 269 263 257 251 241 239 233 229 227 Columns 121 through 150 223 211 199 197 193 191 181 179 173 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 Columns 151 through 168 61 59 53 47 43 41 37 31 29 23 19 17 13 11 0 0 1 0 r = 9 a = Columns 1 through 30 0 1 0 0 0 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 60 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 Columns 61 through 90 283 293 307 311 313 ...

Assertion failed.