Almost prime: Difference between revisions

m
Automated syntax highlighting fixup (second round - minor fixes)
m (syntax highlighting fixup automation)
m (Automated syntax highlighting fixup (second round - minor fixes))
Line 20:
=={{header|11l}}==
{{trans|Kotlin}}
<syntaxhighlight lang="11l">F k_prime(k, =n)
V f = 0
V p = 2
Line 49:
 
=={{header|Action!}}==
<syntaxhighlight lang=Action"action!">BYTE FUNC IsAlmostPrime(INT num BYTE k)
INT f,p,v
 
Line 102:
This imports the package '''Prime_Numbers''' from [[Prime decomposition#Ada]].
 
<syntaxhighlight lang="ada">with Prime_Numbers, Ada.Text_IO;
procedure Test_Kth_Prime is
Line 137:
=={{header|ALGOL 68}}==
Worth noticing is the n(...)(...) picture in the printf and the WHILE ... DO SKIP OD idiom which is quite common in ALgol 68.
<syntaxhighlight lang="algol68">BEGIN
INT examples=10, classes=5;
MODE SEMIPRIME = STRUCT ([examples]INT data, INT count);
Line 187:
 
=={{header|ALGOL-M}}==
<syntaxhighlight lang="algolm">begin
 
integer function mod(a, b);
Line 239:
=={{header|ALGOL W}}==
{{Trans|C}} with tweaks to the factorisation routine.
<syntaxhighlight lang="algolw">begin
logical procedure kPrime( integer value nv, k ) ;
begin
Line 288:
{{libheader|pco}}
Works in [[Dyalog APL]]
<syntaxhighlight lang=APL"apl">f←{↑r⊣⍵∘{r,∘⊂←⍺↑∪{⍵[⍋⍵]},f∘.×⍵}⍣(⍺-1)⊃r←⊂f←pco¨⍳⍵}</syntaxhighlight>
{{out}}
<pre>
Line 301:
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
<syntaxhighlight lang=ARM"arm Assemblyassembly">
/* ARM assembly Raspberry PI */
/* program kprime.s */
Line 535:
=={{header|Arturo}}==
 
<syntaxhighlight lang="rebol">almostPrime: function [k, listLen][
result: new []
test: 2
Line 575:
ASIC has both FOR and WHILE loops, but it had better not go out from the loop. So, in the subroutine CHECKKPRIME they are simulated by the constructs with GOTO statements.
 
<syntaxhighlight lang="basic">
REM Almost prime
FOR K = 1 TO 5
Line 635:
=={{header|AutoHotkey}}==
Translation of the C Version
<syntaxhighlight lang=AutoHotkey"autohotkey">kprime(n,k) {
p:=2, f:=0
while( (f<k) && (p*p<=n) ) {
Line 671:
 
=={{header|AWK}}==
<syntaxhighlight lang=AWK"awk">
# syntax: GAWK -f ALMOST_PRIME.AWK
BEGIN {
Line 708:
 
=={{header|BASIC}}==
<syntaxhighlight lang="basic">10 DEFINT A-Z
20 FOR K=1 TO 5
30 PRINT USING "K = #:";K;
Line 732:
=={{header|BASIC256}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="freebasic">function kPrime(n, k)
f = 0
for i = 2 to n
Line 762:
=={{header|BCPL}}==
{{trans|C}}
<syntaxhighlight lang=BCPL"bcpl">get "libhdr"
 
let kprime(n, k) = valof
Line 802:
The extra spaces are to ensure it's readable on buggy interpreters that don't include a space after numeric output.
 
<syntaxhighlight lang="befunge">1>::48*"= k",,,,02p.":",01v
|^ v0!`\*:g40:<p402p300:+1<
K| >2g03g`*#v_ 1`03g+02g->|
Line 817:
 
=={{header|C}}==
<syntaxhighlight lang="c">#include <stdio.h>
 
int kprime(int n, int k)
Line 857:
 
=={{header|C sharp|C#}}==
<syntaxhighlight lang="csharp">using System;
using System.Collections.Generic;
using System.Linq;
Line 923:
=={{header|C++}}==
{{trans|Kotlin}}
<syntaxhighlight lang="cpp">#include <cstdlib>
#include <iostream>
#include <sstream>
Line 964:
=={{header|Clojure}}==
 
<syntaxhighlight lang="clojure">
 
(ns clojure.examples.almostprime
Line 1,000:
 
=={{header|CLU}}==
<syntaxhighlight lang="clu">kprime = proc (n,k: int) returns (bool)
f: int := 0
p: int := 2
Line 1,039:
=={{header|COBOL}}==
{{trans|C}}
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
PROGRAM-ID. ALMOST-PRIME.
Line 1,116:
 
=={{header|Common Lisp}}==
<syntaxhighlight lang="lisp">(defun start ()
(loop for k from 1 to 5
do (format t "k = ~a: ~a~%" k (collect-k-almost-prime k))))
Line 1,140:
=={{header|Cowgol}}==
{{trans|C}}
<syntaxhighlight lang="cowgol">include "cowgol.coh";
 
sub kprime(n: uint8, k: uint8): (kp: uint8) is
Line 1,191:
This contains a copy of the function <code>decompose</code> from the Prime decomposition task.
{{trans|Ada}}
<syntaxhighlight lang="d">import std.stdio, std.algorithm, std.traits;
 
Unqual!T[] decompose(T)(in T number) pure nothrow
Line 1,238:
{{trans|C}}
 
<syntaxhighlight lang=Delphi"delphi">
program AlmostPrime;
 
Line 1,289:
 
=={{header|Draco}}==
<syntaxhighlight lang="draco">proc nonrec kprime(word n, k) bool:
word f, p;
f := 0;
Line 1,330:
=={{header|EchoLisp}}==
Small numbers : filter the sequence [ 2 .. n]
<syntaxhighlight lang="scheme">
(define (almost-prime? p k)
(= k (length (prime-factors p))))
Line 1,344:
</syntaxhighlight>
{{out}}
<syntaxhighlight lang="scheme">
(task)
 
Line 1,354:
</syntaxhighlight>
Large numbers : generate - combinations with repetitions - k-almost-primes up to pmax.
<syntaxhighlight lang="scheme">
(lib 'match)
(define-syntax-rule (: v i) (vector-ref v i))
Line 1,408:
 
{{out}}
<syntaxhighlight lang="scheme">
;; we want 500-almost-primes from the 10000-th.
(take (drop (list-sort < (almost-primes 500 10000)) 10000 ) 10)
Line 1,422:
=={{header|Elixir}}==
{{trans|Erlang}}
<syntaxhighlight lang="elixir">defmodule Factors do
def factors(n), do: factors(n,2,[])
Line 1,458:
Using the factors function from [[Prime_decomposition#Erlang]].
 
<syntaxhighlight lang="erlang">
-module(factors).
-export([factors/1,kfactors/0,kfactors/2]).
Line 1,509:
 
=={{header|ERRE}}==
<syntaxhighlight lang=ERRE"erre">
PROGRAM ALMOST_PRIME
 
Line 1,555:
 
=={{header|F_Sharp|F#}}==
<syntaxhighlight lang="fsharp">let rec genFactor (f, n) =
if f > n then None
elif n % f = 0 then Some (f, (f, n/f))
Line 1,582:
 
=={{header|Factor}}==
<syntaxhighlight lang="factor">USING: formatting fry kernel lists lists.lazy locals
math.combinatorics math.primes.factors math.ranges sequences ;
IN: rosetta-code.almost-prime
Line 1,605:
 
=={{header|FOCAL}}==
<syntaxhighlight lang="focal">01.10 F K=1,5;D 3
01.20 Q
 
Line 1,633:
 
=={{header|Fortran}}==
<syntaxhighlight lang="fortran">
program almost_prime
use iso_fortran_env, only: output_unit
Line 1,691:
 
=={{header|FreeBASIC}}==
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64
 
Function kPrime(n As Integer, k As Integer) As Boolean
Line 1,734:
 
=={{header|Frink}}==
<syntaxhighlight lang="frink">for k = 1 to 5
{
n=2
Line 1,763:
=={{header|Futhark}}==
 
<syntaxhighlight lang=Futhark"futhark">
let kprime(n: i32, k: i32): bool =
let (p,f) = (2, 0)
Line 1,785:
 
=={{header|Go}}==
<syntaxhighlight lang="go">package main
 
import "fmt"
Line 1,831:
 
=={{header|Groovy}}==
<syntaxhighlight lang=Groovy"groovy">
public class almostprime
{
Line 1,884:
{{trans|FreeBASIC}}
{{works with|PC-BASIC|any}}
<syntaxhighlight lang="qbasic">
10 'Almost prime
20 FOR K% = 1 TO 5
Line 1,921:
 
=={{header|Haskell}}==
<syntaxhighlight lang=Haskell"haskell">isPrime :: Integral a => a -> Bool
isPrime n = not $ any ((0 ==) . (mod n)) [2..(truncate $ sqrt $ fromIntegral n)]
 
Line 1,947:
 
Larger ''k''s require more complicated methods:
<syntaxhighlight lang="haskell">primes = 2:3:[n | n <- [5,7..], foldr (\p r-> p*p > n || rem n p > 0 && r)
True (drop 1 primes)]
 
Line 1,990:
 
Works in both languages.
<syntaxhighlight lang="unicon">link "factors"
 
procedure main()
Line 2,013:
 
=={{header|J}}==
<syntaxhighlight lang=J"j"> (10 {. [:~.[:/:~[:,*/~)^:(i.5)~p:i.10
2 3 5 7 11 13 17 19 23 29
4 6 9 10 14 15 21 22 25 26
Line 2,029:
 
=={{header|Java}}==
<syntaxhighlight lang="java">public class AlmostPrime {
public static void main(String[] args) {
for (int k = 1; k <= 5; k++) {
Line 2,066:
 
=={{header|Javascript}}==
<syntaxhighlight lang="javascript">function almostPrime (n, k) {
var divisor = 2, count = 0
while(count < k + 1 && n != 1) {
Line 2,101:
{{Works with| jq|1.4}}
'''Infrastructure:'''
<syntaxhighlight lang="jq"># Recent versions of jq (version > 1.4) have the following definition of "until":
def until(cond; next):
def _until:
Line 2,186:
end;</syntaxhighlight>
'''isalmostprime'''
<syntaxhighlight lang="jq">def isalmostprime(k): (prime_factors_with_multiplicities | length) == k;
 
# Emit a stream of the first N almost-k primes
Line 2,201:
end;</syntaxhighlight>
'''The task:'''
<syntaxhighlight lang="jq">range(1;6) as $k | "k=\($k): \([almostprimes(10;$k)])"</syntaxhighlight>
{{out}}
<syntaxhighlight lang="sh">$ jq -c -r -n -f Almost_prime.jq
k=1: [2,3,5,7,11,13,17,19,23,29]
k=2: [4,6,9,10,14,15,21,22,25,26]
Line 2,212:
=={{header|Julia}}==
{{works with|Julia|1.1}}
<syntaxhighlight lang="julia">using Primes
 
isalmostprime(n::Integer, k::Integer) = sum(values(factor(n))) == k
Line 2,239:
=={{header|Kotlin}}==
{{trans|Java}}
<syntaxhighlight lang="scala">fun Int.k_prime(x: Int): Boolean {
var n = x
var f = 0
Line 2,274:
{{trans|FreeBASIC}}
{{works with|Just BASIC}}
<syntaxhighlight lang="lb">
' Almost prime
for k = 1 to 5
Line 2,313:
 
=={{header|Lua}}==
<syntaxhighlight lang=Lua"lua">-- Returns boolean indicating whether n is k-almost prime
function almostPrime (n, k)
local divisor, count = 2, 0
Line 2,355:
 
=={{header|Maple}}==
<syntaxhighlight lang=Maple"maple">AlmostPrimes:=proc(k, numvalues::posint:=10)
local aprimes, i, intfactors;
aprimes := Array([]);
Line 2,380:
 
=={{header|MAD}}==
<syntaxhighlight lang=MAD"mad"> NORMAL MODE IS INTEGER
INTERNAL FUNCTION(NN,KK)
Line 2,430:
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<syntaxhighlight lang=Mathematica"mathematica">kprimes[k_,n_] :=
(* generates a list of the n smallest k-almost-primes *)
Module[{firstnprimes, runningkprimes = {}},
Line 2,452:
 
=={{header|Modula-2}}==
<syntaxhighlight lang="modula2">MODULE AlmostPrime;
FROM FormatString IMPORT FormatString;
FROM Terminal IMPORT WriteString,WriteLn,ReadChar;
Line 2,502:
{{trans|GW-BASIC}}
{{works with|Nascom ROM BASIC|4.7}}
<syntaxhighlight lang="basic">
10 REM Almost prime
20 FOR K=1 TO 5
Line 2,542:
 
=={{header|Nim}}==
<syntaxhighlight lang=Nim"nim">proc prime(k: int, listLen: int): seq[int] =
result = @[]
var
Line 2,574:
=={{header|Objeck}}==
{{trans|C}}
<syntaxhighlight lang="objeck">class Kth_Prime {
function : native : kPrime(n : Int, k : Int) ~ Bool {
f := 0;
Line 2,612:
=={{header|Oforth}}==
 
<syntaxhighlight lang=Oforth"oforth">: kprime?( n k -- b )
| i |
0 2 n for: i [
Line 2,638:
 
=={{header|PARI/GP}}==
<syntaxhighlight lang="parigp">almost(k)=my(n); for(i=1,10,while(bigomega(n++)!=k,); print1(n", "));
for(k=1,5,almost(k);print)</syntaxhighlight>
{{out}}
Line 2,650:
{{libheader|primTrial}}
{{works with|Free Pascal}}
<syntaxhighlight lang=Pascal"pascal">program AlmostPrime;
{$IFDEF FPC}
{$Mode Delphi}
Line 2,691:
Using a CPAN module, which is simple and fast:
{{libheader|ntheory}}
<syntaxhighlight lang="perl">use ntheory qw/factor/;
sub almost {
my($k,$n) = @_;
Line 2,707:
</pre>
or writing everything by hand:
<syntaxhighlight lang="perl">use strict;
use warnings;
 
Line 2,781:
=={{header|Phixmonti}}==
{{trans|OForth}}
<syntaxhighlight lang=Phixmonti"phixmonti">/# Rosetta Code problem: http://rosettacode.org/wiki/Almost_prime
by Galileo, 06/2022 #/
 
Line 2,816:
=={{header|PHP}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="php">
<?php
// Almost prime
Line 2,860:
=={{header|Picat}}==
{{trans|J}}
<syntaxhighlight lang=Picat"picat">go =>
N = 10,
Ps = primes(100).take(N),
Line 2,911:
=={{header|PL/I}}==
{{trans|C}}
<syntaxhighlight lang="pli">almost_prime: procedure options(main);
kprime: procedure(nn, k) returns(bit);
declare (n, nn, k, p, f) fixed;
Line 2,946:
=={{header|PL/M}}==
{{trans|C}}
<syntaxhighlight lang="plm">100H:
BDOS: PROCEDURE (FN, ARG); DECLARE FN BYTE, ARG ADDRESS; GO TO 5; END BDOS;
EXIT: PROCEDURE; CALL BDOS(0,0); END EXIT;
Line 3,006:
 
=={{header|Phix}}==
<!--<syntaxhighlight lang=Phix"phix">(phixonline)-->
<span style="color: #004080;">sequence</span> <span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">columnize</span><span style="color: #0000FF;">({</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #000000;">5</span><span style="color: #0000FF;">)})</span> <span style="color: #000080;font-style:italic;">-- ie {{1},{2},{3},{4},{5}}</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">n</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">2</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">found</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">0</span>
Line 3,032:
 
=={{header|PicoLisp}}==
<syntaxhighlight lang=PicoLisp"picolisp">(de factor (N)
(make
(let
Line 3,061:
 
=={{header|Potion}}==
<syntaxhighlight lang="potion"># Converted from C
kprime = (n, k):
p = 2, f = 0
Line 3,085:
 
=={{header|Prolog}}==
<syntaxhighlight lang="prolog">% almostPrime(K, +Take, List) succeeds if List can be unified with the
% first Take K-almost-primes.
% Notice that K need not be specified.
Line 3,106:
take(Take, Sorted, List).
</syntaxhighlight>That's it. The rest is machinery. For portability, a compatibility section is included below.
<syntaxhighlight lang=Prolog"prolog">nPrimes( M, Primes) :- nPrimes( [2], M, Primes).
 
nPrimes( Accumulator, I, Primes) :-
Line 3,147:
append(Head,X,List).
</syntaxhighlight>
<syntaxhighlight lang=Prolog"prolog">%%%%% compatibility section %%%%%
 
:- if(current_prolog_flag(dialect, yap)).
Line 3,192:
 
=={{header|Processing}}==
<syntaxhighlight lang="processing">void setup() {
for (int i = 1; i <= 5; i++) {
int count = 0;
Line 3,238:
=={{header|PureBasic}}==
{{trans|C}}
<syntaxhighlight lang=PureBasic"purebasic">EnableExplicit
 
Procedure.b kprime(n.i, k.i)
Line 3,290:
=={{header|Python}}==
This imports [[Prime decomposition#Python]]
<syntaxhighlight lang="python">from prime_decomposition import decompose
from itertools import islice, count
try:
Line 3,321:
 
 
<syntaxhighlight lang="python">
# k-Almost-primes
# Python 3.6.3
Line 3,375:
<code>primefactors</code> is defined at [[Prime decomposition#Quackery]].
 
<syntaxhighlight lang=Quackery"quackery"> [ stack ] is quantity ( --> s )
[ stack ] is factors ( --> s )
 
Line 3,406:
=={{header|R}}==
This uses the function from [[Prime decomposition#R]]
<syntaxhighlight lang="rsplus">#===============================================================
# Find k-Almost-primes
# R implementation
Line 3,467:
=={{header|Racket}}==
 
<syntaxhighlight lang="racket">#lang racket
(require (only-in math/number-theory factorize))
 
Line 3,504:
{{trans|C}}
{{works with|Rakudo|2015.12}}
<syntaxhighlight lang=perl6"raku" line>sub is-k-almost-prime($n is copy, $k) returns Bool {
loop (my ($p, $f) = 2, 0; $f < $k && $p*$p <= $n; $p++) {
$n /= $p, $f++ while $n %% $p;
Line 3,523:
Here is a solution with identical output based on the <tt>factors</tt> routine from [[Count_in_factors#Raku]] (to be included manually until we decide where in the distribution to put it).
 
<syntaxhighlight lang=perl6"raku" line>constant @primes = 2, |(3, 5, 7 ... *).grep: *.is-prime;
 
multi sub factors(1) { 1 }
Line 3,552:
 
The first three &nbsp; '''k-almost''' &nbsp; primes for each &nbsp; '''K''' &nbsp; group are computed directly &nbsp; (rather than found).
<syntaxhighlight lang="rexx">/*REXX program computes and displays the first N K─almost primes from 1 ──► K. */
parse arg N K . /*get optional arguments from the C.L. */
if N=='' | N=="," then N=10 /*N not specified? Then use default.*/
Line 3,623:
 
Once the required primes are generated, the finding of the K─almost primes is almost instantaneous.
<syntaxhighlight lang="rexx">/*REXX program computes and displays the first N K─almost primes from 1 ──► K. */
parse arg N K . /*obtain optional arguments from the CL*/
if N=='' | N==',' then N=10 /*N not specified? Then use default.*/
Line 3,712:
 
=={{header|Ring}}==
<syntaxhighlight lang="ring">
for ap = 1 to 5
see "k = " + ap + ":"
Line 3,757:
 
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">require 'prime'
 
def almost_primes(k=2)
Line 3,775:
 
{{trans|J}}
<syntaxhighlight lang="ruby">require 'prime'
 
p ar = pr = Prime.take(10)
Line 3,789:
 
=={{header|Rust}}==
<syntaxhighlight lang="rust">fn is_kprime(n: u32, k: u32) -> bool {
let mut primes = 0;
let mut f = 2;
Line 3,838:
 
=={{header|Scala}}==
<syntaxhighlight lang=Scala"scala">def isKPrime(n: Int, k: Int, d: Int = 2): Boolean = (n, k, d) match {
case (n, k, _) if n == 1 => k == 0
case (n, _, d) if n % d == 0 => isKPrime(n / d, k - 1, d)
Line 3,865:
 
=={{header|Seed7}}==
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i";
 
const func boolean: kprime (in var integer: number, in integer: k) is func
Line 3,913:
 
=={{header|SequenceL}}==
<syntaxhighlight lang="sequencel">import <Utilities/Conversion.sl>;
import <Utilities/Sequence.sl>;
 
Line 3,950:
=={{header|Sidef}}==
{{trans|Raku}}
<syntaxhighlight lang="ruby">func is_k_almost_prime(n, k) {
for (var (p, f) = (2, 0); (f < k) && (p*p <= n); ++p) {
(n /= p; ++f) while (p `divides` n)
Line 3,979:
=={{header|Swift}}==
 
<syntaxhighlight lang="swift">struct KPrimeGen: Sequence, IteratorProtocol {
let k: Int
private(set) var n: Int
Line 4,026:
{{works with|Tcl|8.6}}
{{tcllib|math::numtheory}}
<syntaxhighlight lang="tcl">package require Tcl 8.6
package require math::numtheory
 
Line 4,067:
 
=={{header|Tiny BASIC}}==
<syntaxhighlight lang="tinybasic">
REM Almost prime
LET K=1
Line 4,162:
== {{header|TypeScript}} ==
{{trans|FreeBASIC}}
<syntaxhighlight lang="javascript">// Almost prime
 
function isKPrime(n: number, k: number): bool {
Line 4,200:
=={{header|uBasic/4tH}}==
{{trans|C}}
<syntaxhighlight lang="text">Local(3)
 
For c@ = 1 To 5
Line 4,231:
Return (b@ = (d@ + (a@ > 1)))</syntaxhighlight>
{{trans|FreeBASIC}}
<syntaxhighlight lang="text">For k = 1 To 5
Print "k = "; k; " : ";
i = 2
Line 4,268:
 
=={{header|VBA}}==
{{trans|Phix}}<syntaxhighlight lang="vb">Private Function kprime(ByVal n As Integer, k As Integer) As Boolean
Dim p As Integer, factors As Integer
p = 2
Line 4,308:
=={{header|VBScript}}==
Repurposed the VBScript code for the Prime Decomposition task.
<syntaxhighlight lang="vb">
For k = 1 To 5
count = 0
Line 4,376:
=={{header|Visual Basic .NET}}==
{{trans|C#}}
<syntaxhighlight lang="vbnet">Module Module1
 
Class KPrime
Line 4,429:
=={{header|Vlang}}==
{{trans|go}}
<syntaxhighlight lang="vlang">fn k_prime(n int, k int) bool {
mut nf := 0
mut nn := n
Line 4,473:
=={{header|Wren}}==
{{trans|Go}}
<syntaxhighlight lang="ecmascript">var kPrime = Fn.new { |n, k|
var nf = 0
var i = 2
Line 4,512:
{{trans|FreeBASIC}}
{{works with|Windows XBasic}}
<syntaxhighlight lang="xbasic">
' Almost prime
PROGRAM "almostprime"
Line 4,560:
 
=={{header|XPL0}}==
<syntaxhighlight lang=XPL0"xpl0">func Factors(N); \Return number of (prime) factors in N
int N, F, C;
[C:= 0; F:= 2;
Line 4,599:
=={{header|Yabasic}}==
{{trans|Lua}}
<syntaxhighlight lang=Yabasic"yabasic">// Returns boolean indicating whether n is k-almost prime
sub almostPrime(n, k)
local divisor, count
Line 4,646:
 
Can't say I entirely understand this algorithm. Uses list comprehension to calculate the outer/tensor product (p10 ⊗ ar).
<syntaxhighlight lang="zkl">primes:=Utils.Generator(Import("sieve").postponed_sieve);
(p10:=ar:=primes.walk(10)).println();
do(4){
Line 4,662:
=={{header|ZX Spectrum Basic}}==
{{trans|AWK}}
<syntaxhighlight lang="zxbasic">10 FOR k=1 TO 5
20 PRINT k;":";
30 LET c=0: LET i=1
10,327

edits