Numbers with prime digits whose sum is 13: Difference between revisions
Content deleted Content added
m →Alternate: fixed indent |
→{{header|Visual Basic .NET}}: added alternate version, based on Nigel's suggestion, thanks |
||
Line 705: | Line 705: | ||
<pre style="white-space:pre-wrap;">337 355 373 535 553 733 2227 2272 2335 2353 2533 2722 3235 3253 3325 3352 3523 3532 5233 5323 5332 7222 22225 22252 22333 22522 23233 23323 23332 25222 32233 32323 32332 33223 33232 33322 52222 222223 222232 222322 223222 232222 322222 |
<pre style="white-space:pre-wrap;">337 355 373 535 553 733 2227 2272 2335 2353 2533 2722 3235 3253 3325 3352 3523 3532 5233 5323 5332 7222 22225 22252 22333 22522 23233 23323 23332 25222 32233 32323 32332 33223 33232 33322 52222 222223 222232 222322 223222 232222 322222 |
||
</pre> |
</pre> |
||
=== Alternate === |
|||
Thanks to '''Nigel Galloway's''' suggestion from the discussion page. |
|||
<lang vbnet>Imports Tu = System.Tuple(Of Integer, Integer) |
|||
Module Module1 |
|||
Sub Main() |
|||
Dim w As New List(Of Tu), sum, x As Integer, |
|||
lst() As Integer = { 2, 3, 5, 7 } |
|||
For Each x In lst : w.Add(New Tu(x, x)) : Next |
|||
While w.Count > 0 : With w(0) : For Each j As Integer In lst |
|||
sum = .Item2 + j |
|||
If sum = 13 Then Console.Write("{0}{1} ", .Item1, j) |
|||
If sum < 12 Then w.Add(New Tu(.Item1 * 10 + j, sum)) |
|||
Next : End With : w.RemoveAt(0) : End While |
|||
End Sub |
|||
End Module</lang> |
|||
Same output. |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |