#APL(NARS), 39 chars, 78 bytes
APL(NARS), 39 chars, 78 bytes
{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}
1π is the next prime number...; test:
f←{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}
f ̈1 2 3 10
11 23 23 1033
but that already at 20 goes out the stack space... Instead this below seems ok even if has lenght a little more long (61 chars)
∇r←f w;i;k;s
r←2⋄s←⍕w⋄i×ばつ⍳(w≤i)∧k←∨/s⍷⍕r⋄r←1πr⋄i+←k⋄→2
∇
f ̈1 2 3 10 20 100
11 23 23 1033 4201 100999
#APL(NARS), 39 chars, 78 bytes
{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}
1π is the next prime number...; test:
f←{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}
f ̈1 2 3 10
11 23 23 1033
but that already at 20 goes out the stack space... Instead this below seems ok even if has lenght a little more long (61 chars)
∇r←f w;i;k;s
r←2⋄s←⍕w⋄i×ばつ⍳(w≤i)∧k←∨/s⍷⍕r⋄r←1πr⋄i+←k⋄→2
∇
f ̈1 2 3 10 20 100
11 23 23 1033 4201 100999
APL(NARS), 39 chars, 78 bytes
{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}
1π is the next prime number...; test:
f←{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}
f ̈1 2 3 10
11 23 23 1033
but that already at 20 goes out the stack space... Instead this below seems ok even if has lenght a little more long (61 chars)
∇r←f w;i;k;s
r←2⋄s←⍕w⋄i×ばつ⍳(w≤i)∧k←∨/s⍷⍕r⋄r←1πr⋄i+←k⋄→2
∇
f ̈1 2 3 10 20 100
11 23 23 1033 4201 100999
#APL(NARS), 39 chars, 78 bytes
{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}
1π is the next prime number...; test:
f←{s←⍕w←⍵⋄2{(w≤⍵)∧k←∨/s⍷⍕⍺:⍺⋄(1π⍺)∇⍵+k}1}
f ̈1 2 3 10
11 23 23 1033
but that already at 20 goes out the stack space... Instead this below seems ok even if has lenght a little more long (61 chars)
∇r←f w;i;k;s
r←2⋄s←⍕w⋄i×ばつ⍳(w≤i)∧k←∨/s⍷⍕r⋄r←1πr⋄i+←k⋄→2
∇
f ̈1 2 3 10 20 100
11 23 23 1033 4201 100999