Ascending primes: Difference between revisions

Content added Content deleted
Line 887: Line 887:


=={{header|Matlab}}==
=={{header|Matlab}}==
{{trans|Java}}
<lang matlab>queue = 1:9;

j = 1;
while j < length(queue)
n = queue(j);
j = j + 1;
a = n * 10 + mod(n, 10) + 1;
b = n * 10 + 9;
if a <= b
queue = [queue, a:b];
end
end

queue(isprime(queue))</lang>

{{Output}}
<pre>ans =

Columns 1 through 8

2 3 5 7 13 17 19 23

Columns 9 through 16

29 37 47 59 67 79 89 127

Columns 17 through 24

137 139 149 157 167 179 239 257

Columns 25 through 32

269 347 349 359 367 379 389 457

Columns 33 through 40

467 479 569 1237 1249 1259 1279 1289

Columns 41 through 48

1367 1459 1489 1567 1579 1789 2347 2357

Columns 49 through 56

2389 2459 2467 2579 2689 2789 3457 3467

Columns 57 through 64

3469 4567 4679 4789 5689 12347 12379 12457

Columns 65 through 72

12479 12569 12589 12689 13457 13469 13567 13679

Columns 73 through 80

13789 15679 23459 23567 23689 23789 25679 34589

Columns 81 through 88

34679 123457 123479 124567 124679 125789 134789 145679

Columns 89 through 96

234589 235679 235789 245789 345679 345689 1234789 1235789

Columns 97 through 100

1245689 1456789 12356789 23456789</pre>


=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==