Numbers with prime digits whose sum is 13: Difference between revisions

Added vb.NET, translation of Phix
(added C# version, translation of Phix)
(Added vb.NET, translation of Phix)
Line 361:
Unlucky numbers are:
[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>
 
=={{header|Visual Basic .NET}}==
{{Trans|Phix}}
Same recursive method.
<lang vbnet>Imports System
Imports System.Console
Imports LI = System.Collections.Generic.SortedSet(Of Integer)
 
Module Module1
Function unl(ByVal res As LI, ByVal lst As LI, ByVal lft As Integer, ByVal Optional mul As Integer = 1, ByVal Optional vlu As Integer = 0) As LI
If lft = 0 Then
res.Add(vlu)
ElseIf lft > 0 Then
For Each itm As Integer In lst
res = unl(res, lst, lft - itm, mul * 10, vlu + itm * mul)
Next
End If
Return res
End Function
 
Sub Main(ByVal args As String())
WriteLine(string.Join(" ",
unl(new LI From {}, new LI From { 2, 3, 5, 7 }, 13)))
End Sub
End Module</lang>
{{out}}
<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>