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

# Solution 269877

Submitted on 30 Jun 2013 by Richard Zapor

Correct

134Size
`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=3; p=3;
[a,b]=APk_min_end(p,n);
toc
assert(isequal(a+b*prod(primes(p))*n,23))
```
```Elapsed time is 0.188032 seconds.
```
2
Pass

```%%
n=4; p=3;
[a,b]=APk_min_end(p,n);
toc
assert(isequal(a+b*prod(primes(p))*n,29))
```
```Elapsed time is 0.379794 seconds.
```
3
Pass

```%%
n=5; p=5;
[a,b]=APk_min_end(p,n);
toc
assert(isequal(a+b*prod(primes(p))*n,157))
```
```Elapsed time is 0.537710 seconds.
```
4
Pass

```%%
n=6; k=5;
[a,b]=APk_min_end(k,n);
toc
assert(isequal(a+b*prod(primes(k))*n,907))
```
```Elapsed time is 4.190640 seconds.
```
5
Pass

```%%
n=7; k=7;
[a,b]=APk_min_end(k,n);
toc
assert(isequal(a+b*prod(primes(k))*n,1669))
```
```Elapsed time is 4.352927 seconds.
```
6
Pass

```%%
n=8; k=7;
[a,b]=APk_min_end(k,n);
toc
assert(isequal(a+b*prod(primes(k))*n,1879))
```
```Elapsed time is 4.514223 seconds.
```
7
Pass

```%%
n=9; k=7;
[a,b]=APk_min_end(k,n);
toc
assert(isequal(a+b*prod(primes(k))*n,2089))
```
```Elapsed time is 4.676382 seconds.
```
8
Pass

```%%
n=10; k=11;
[a,b]=APk_min_end(k,n);
toc
assert(isequal(a+b*prod(primes(k))*n,249037))
```
```Elapsed time is 13.222813 seconds.
```
9
Pass

```%%
n=11; k=11;
[a,b]=APk_min_end(k,n);
toc
assert(isequal(a+b*prod(primes(k))*n,262897))
```
```Elapsed time is 22.148131 seconds.
```
10
Pass

```%%
n=12; k=13;
[a,b]=APk_min_end(k,n);
toc
assert(isequal(a+b*prod(primes(k))*n,725663))
```
```Elapsed time is 24.477199 seconds.
```