Largest proper divisor of n: Difference between revisions

m
syntax highlighting fixup automation
m (syntax highlighting fixup automation)
Line 7:
{{trans|Python}}
 
<langsyntaxhighlight lang="11l">F lpd(n)
L(i) (n - 1 .< 0).step(-1)
I n % i == 0
Line 14:
 
L(i) 1..100
print(‘#3’.format(lpd(i)), end' I i % 10 == 0 {"\n"} E ‘’)</langsyntaxhighlight>
 
{{out}}
Line 31:
 
=={{header|Ada}}==
<langsyntaxhighlight Adalang="ada">with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
 
Line 55:
end if;
end loop;
end Main;</langsyntaxhighlight>
{{out}}
<pre>
Line 71:
 
=={{header|ALGOL 68}}==
<langsyntaxhighlight lang="algol68">FOR n TO 100 DO # show the largest proper divisors for n = 1..100 #
INT largest proper divisor := 1;
FOR j FROM ( n OVER 2 ) BY -1 TO 2 WHILE largest proper divisor = 1 DO
Line 81:
IF n MOD 10 = 0 THEN print( ( newline ) ) FI
OD
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 97:
 
=={{header|ALGOL W}}==
<langsyntaxhighlight lang="algolw">for n := 1 until 100 do begin % show the largest proper divisors for n = 1..100 %
for j := n div 2 step -1 until 2 do begin
if n rem j = 0 then begin
Line 107:
foundLargestProperDivisor:
if n rem 10 = 0 then write()
end for_n.</langsyntaxhighlight>
{{out}}
<pre>
Line 124:
=={{header|APL}}==
{{works with|Dyalog APL}}
<langsyntaxhighlight lang="apl">(⌈/1,(⍸0=¯1↓⍳|⊢))¨10 10⍴⍳100</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 140:
Most of this code is just to prepare the output for display. :D
 
<langsyntaxhighlight lang="applescript">on largestProperDivisor(n)
if (n mod 2 = 0) then return n div 2
if (n mod 3 = 0) then return n div 3
Line 179:
end task
 
task(100)</langsyntaxhighlight>
 
{{output}}
<langsyntaxhighlight lang="applescript">"1:1 2:1 3:1 4:2 5:1 6:3 7:1 8:4 9:3 10:5
11:1 12:6 13:1 14:7 15:5 16:8 17:1 18:9 19:1 20:10
21:7 22:11 23:1 24:12 25:5 26:13 27:9 28:14 29:1 30:15
Line 191:
71:1 72:36 73:1 74:37 75:25 76:38 77:11 78:39 79:1 80:40
81:27 82:41 83:1 84:42 85:17 86:43 87:29 88:44 89:1 90:45
91:13 92:46 93:31 94:47 95:19 96:48 97:1 98:49 99:33 100:50 "</langsyntaxhighlight>
 
 
Line 198:
Composing functionally, for rapid drafting and refactoring, with higher levels of code reuse:
 
<langsyntaxhighlight lang="applescript">use framework "Foundation"
 
 
Line 446:
item 1 of ((ca's NSArray's arrayWithObject:nsValue) as list)
end if
end unwrap</langsyntaxhighlight>
{{Out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 461:
=={{header|Arturo}}==
 
<langsyntaxhighlight lang="rebol">loop split.every:10 [1] ++ map 2..100 'x -> last chop factors x 'row [
print map to [:string] row 'r -> pad r 5
]</langsyntaxhighlight>
 
{{out}}
Line 479:
 
=={{header|AWK}}==
<syntaxhighlight lang="awk">
<lang AWK>
# syntax: GAWK -f LARGEST_PROPER_DIVISOR_OF_N.AWK
# converted from C
Line 501:
}
}
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 519:
 
=={{header|BASIC}}==
<langsyntaxhighlight lang="basic">10 DEFINT A-Z
20 FOR I=1 TO 100
30 IF I=1 THEN PRINT " 1";: GOTO 70
Line 526:
60 NEXT J
70 IF I MOD 10=0 THEN PRINT
80 NEXT I</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 541:
=={{header|BASIC256}}==
{{trans|FreeBASIC}}
<langsyntaxhighlight BASIC256lang="basic256">print "El mayor divisor propio de n es:\n"
print " 1 1 ";
for i = 3 to 100
Line 552:
if i % 10 = 0 then print
next i
end</langsyntaxhighlight>
 
 
=={{header|BCPL}}==
<langsyntaxhighlight lang="bcpl">get "libhdr"
 
let lpd(n) = valof
Line 566:
$( writed(lpd(i), 3)
if i rem 10=0 then wrch('*N')
$)</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 580:
 
=={{header|BQN}}==
<langsyntaxhighlight lang="bqn">(1⌈´↕×0=↕|⊢)¨ ∘‿10⥊1+↕100</langsyntaxhighlight>
{{out}}
<pre>┌─
Line 596:
 
=={{header|C}}==
<langsyntaxhighlight lang="c">#include <stdio.h>
 
unsigned int lpd(unsigned int n) {
Line 612:
}
return 0;
}</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 626:
 
=={{header|C++}}==
<langsyntaxhighlight lang="cpp">#include <cassert>
#include <iomanip>
#include <iostream>
Line 646:
<< (n % 10 == 0 ? '\n' : ' ');
}
}</langsyntaxhighlight>
 
{{out}}
Line 663:
 
=={{header|Cowgol}}==
<langsyntaxhighlight lang="cowgol">include "cowgol.coh";
 
sub print3(n: uint8) is
Line 696:
end if;
i := i + 1;
end loop;</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 710:
 
=={{header|Draco}}==
<langsyntaxhighlight lang="draco">proc nonrec lpd(word n) word:
word d;
if n=1 then
Line 727:
if n%10 = 0 then writeln() fi
od
corp</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 741:
 
=={{header|F_Sharp|F#}}==
<langsyntaxhighlight lang="fsharp">
// Largest proper divisor of n: Nigel Galloway. June 2nd., 2021
let fN g=let rec fN n=let i=Seq.head n in match(g/i,g%i) with (1,_)->1 |(n,0)->n |_->fN(Seq.tail n) in fN(Seq.initInfinite((+)2))
seq{yield 1; yield! seq{2..100}|>Seq.map fN}|>Seq.iter(printf "%d "); printfn ""
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 754:
=={{header|Factor}}==
{{works with|Factor|0.99 2021-02-05}}
<langsyntaxhighlight lang="factor">USING: grouping kernel math math.bitwise math.functions
math.ranges prettyprint sequences ;
 
Line 763:
: largest ( m -- n ) dup odd? [ odd ] [ 2/ ] if ;
 
100 [1,b] [ largest ] map 10 group simple-table.</langsyntaxhighlight>
{{out}}
<pre>
Line 779:
 
=={{header|Fermat}}==
<langsyntaxhighlight lang="fermat">Func Lpd(n) =
if n = 1 then Return(1) fi;
for i = n\2 to 1 by -1 do
Line 788:
!(Lpd(m):4);
if m|10=0 then ! fi;
od;</langsyntaxhighlight>
{{out}}<pre>
1 1 1 2 1 3 1 4 3 5
Line 803:
 
=={{header|FOCAL}}==
<langsyntaxhighlight lang="focal">01.10 F N=1,100;D 2;D 3
01.20 Q
 
Line 817:
03.20 S A=N/10
03.30 I (FITR(A)-A)3.4;T !
03.40 R</langsyntaxhighlight>
{{out}}
<pre>= 1= 1= 1= 2= 1= 3= 1= 4= 3= 5
Line 832:
=={{header|Forth}}==
{{works with|Gforth}}
<langsyntaxhighlight lang="forth">: largest-proper-divisor { n -- n }
n 1 and 0= if n 2/ exit then
3
Line 850:
 
main
bye</langsyntaxhighlight>
 
{{out}}
Line 867:
 
=={{header|Fortran}}==
<langsyntaxhighlight lang="fortran"> program LargestProperDivisors
implicit none
integer i, lpd
Line 885:
20 lpd = i
end if
end function</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 900:
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">Print !"El mayor divisor propio de n es:\n"
Print " 1 1";
For i As Byte = 3 To 100
Line 908:
If i Mod 10 = 0 Then Print
Next i
Sleep</langsyntaxhighlight>
{{out}}
<pre>El mayor divisor propio de n es:
Line 926:
Frink contains efficient routines for factoring numbers. It uses trial division, wheel factoring, and Pollard rho factoring.
 
<langsyntaxhighlight lang="frink">for n = 1 to 100
println[last[allFactors[n,true,false]]]</langsyntaxhighlight>
 
=={{header|Go}}==
<langsyntaxhighlight lang="go">package main
 
import "fmt"
Line 956:
}
}
}</langsyntaxhighlight>
 
{{out}}
Line 974:
 
=={{header|GW-BASIC}}==
<langsyntaxhighlight lang="gwbasic">10 PRINT 1;
20 FOR I = 1 TO 101
30 FOR D = I\2 TO 1 STEP -1
40 IF I MOD D = 0 THEN PRINT D; : GOTO 60
50 NEXT D
60 NEXT I</langsyntaxhighlight>
 
=={{header|Haskell}}==
<langsyntaxhighlight lang="haskell">import Data.List.Split (chunksOf)
import Text.Printf (printf)
 
Line 992:
main =
(putStr . unlines . map concat . chunksOf 10) $
printf "%3d" . lpd <$> [1 .. 100]</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,011:
(Otherwise, the largest proper divisor will be 1 itself).
 
<langsyntaxhighlight lang="haskell">import Data.List (find)
import Data.List.Split (chunksOf)
import Text.Printf (printf)
Line 1,026:
main =
(putStr . unlines . map concat . chunksOf 10) $
printf "%3d" . maxProperDivisors <$> [1 .. 100]</langsyntaxhighlight>
 
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,040:
 
=={{header|J}}==
<langsyntaxhighlight lang="j"> lpd =: (1 |.!.1 ])&.q:</langsyntaxhighlight>
{{out}}
<pre>
Line 1,056:
 
Naive version:
<langsyntaxhighlight lang="jq"># (1|largestpd) is 1 as per the task definition
def largestpd:
if . == 1 then 1
else . as $n
| first( range( ($n - ($n % 2)) /2; 0; -1) | (select($n % . == 0) ))
end;</langsyntaxhighlight>
 
Slightly less naive:
<langsyntaxhighlight lang="jq">def largestpd:
if . == 1 then 1
else . as $n
Line 1,071:
else first( range( ($n - ($n % 11)) /11; 0; -1) | (select($n % . == 0) ))
end
end;</langsyntaxhighlight>
<langsyntaxhighlight lang="jq"># For neatness
def lpad($len):
tostring | ($len - length) as $l | (" " * $l)[:$l] + .;
Line 1,082:
### The task
[range(1; 101) | largestpd]
| nwise(10) | map(lpad(2)) | join(" ")</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,096:
 
=={{header|Julia}}==
<langsyntaxhighlight lang="julia">largestpd(n) = (for i in n÷2:-1:1 (n % i == 0) && return i; end; 1)
 
foreach(n -> print(rpad(largestpd(n), 3), n % 10 == 0 ? "\n" : ""), 1:100)
</langsyntaxhighlight>{{out}}
<pre>
1 1 1 2 1 3 1 4 3 5
Line 1,114:
 
=={{header|MAD}}==
<langsyntaxhighlight MADlang="mad"> NORMAL MODE IS INTEGER
INTERNAL FUNCTION(N)
Line 1,130:
VECTOR VALUES TABLE = $10(I3)*$
END OF PROGRAM </langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,144:
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<langsyntaxhighlight Mathematicalang="mathematica">Last[Prepend[DeleteCases[Divisors[#], #], 1]] & /@ Range[100]</langsyntaxhighlight>
{{out}}
<pre>{1,1,1,2,1,3,1,4,3,5,1,6,1,7,5,8,1,9,1,10,7,11,1,12,5,13,9,14,1,15,1,16,11,17,7,18,1,19,13,20,1,21,1,22,15,23,1,24,7,25,17,26,1,27,11,28,19,29,1,30,1,31,21,32,13,33,1,34,23,35,1,36,1,37,25,38,11,39,1,40,27,41,1,42,17,43,29,44,1,45,13,46,31,47,19,48,1,49,33,50}</pre>
 
=={{header|Modula-2}}==
<langsyntaxhighlight lang="modula2">MODULE LargestProperDivisor;
FROM InOut IMPORT WriteCard, WriteLn;
 
Line 1,175:
END;
END;
END LargestProperDivisor.</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,189:
 
=={{header|Nim}}==
<langsyntaxhighlight Nimlang="nim">import math, strutils
 
func largestProperDivisor(n: Positive): int =
Line 1,197:
 
for n in 1..100:
stdout.write ($n.largestProperDivisor).align(2), if n mod 10 == 0: '\n' else: ' '</langsyntaxhighlight>
 
{{out}}
Line 1,212:
 
=={{header|Pascal}}==
<langsyntaxhighlight lang="pascal">
program LarPropDiv;
 
Line 1,241:
Writeln;
end;
end.</langsyntaxhighlight>
{{out}}
<pre>
Line 1,257:
=={{header|Perl}}==
{{libheader|ntheory}}
<langsyntaxhighlight lang="perl">use strict;
use warnings;
use ntheory 'divisors';
Line 1,275:
while( my @batch = $iter->() ) {
printf '%3d', $_ == 1 ? 1 : max proper_divisors($_) for @batch; print "\n";
}</langsyntaxhighlight>
{{out}}
<pre>GPD for 1 through 100:
Line 1,290:
 
=={{header|Phix}}==
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">join_by</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #004600;">true</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">sprintf</span><span style="color: #0000FF;">,{{</span><span style="color: #008000;">"%3d"</span><span style="color: #0000FF;">},</span><span style="color: #7060A8;">vslice</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #004600;">true</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">factors</span><span style="color: #0000FF;">,{</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #000000;">100</span><span style="color: #0000FF;">),-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">}),</span><span style="color: #7060A8;">reverse</span><span style="color: #0000FF;">),</span><span style="color: #000000;">1</span><span style="color: #0000FF;">)}),</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">10</span><span style="color: #0000FF;">,</span><span style="color: #008000;">""</span><span style="color: #0000FF;">))</span>
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
Line 1,307:
</pre>
Alternative, same output, optimised: obviously checking for a factor from 2 up is going to be significantly faster than n-1 down... or of course as above collecting all of them and extracting/discarding all but the last, at least on much larger numbers, that is, and I suppose you could (perhaps) improve even further on this by only checking primes.
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">for</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #000000;">100</span> <span style="color: #008080;">do</span>
Line 1,323:
<span style="color: #008080;">if</span> <span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">,</span><span style="color: #000000;">10</span><span style="color: #0000FF;">)=</span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span> <span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\n"</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<!--</langsyntaxhighlight>-->
 
=={{header|Picat}}==
<langsyntaxhighlight Picatlang="picat">main =>
foreach(I in 1..100)
printf("%2d%s",a(I), cond(I mod 10 == 0,"\n", " "))
Line 1,337:
N mod I == 0.
a(N,I,Div) :-
a(N,I-1,Div).</langsyntaxhighlight>
 
{{out}}
Line 1,353:
 
=={{header|PL/I}}==
<langsyntaxhighlight lang="pli">largestProperDivisor: procedure options(main);
lpd: procedure(n) returns(fixed);
declare (n, i) fixed;
Line 1,367:
if mod(i,10)=0 then put skip;
end;
end largestProperDivisor;</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,381:
 
=={{header|PL/M}}==
<langsyntaxhighlight 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 1,412:
END;
CALL EXIT;
EOF</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,426:
 
=={{header|PureBasic}}==
<langsyntaxhighlight PureBasiclang="purebasic">Procedure.i lpd(v.i)
For i=v/2 To 1 Step -1
If v%i=0 : ProcedureReturn i : EndIf
Line 1,439:
Next
Input()
EndIf</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,453:
 
=={{header|Python}}==
<langsyntaxhighlight lang="python">def lpd(n):
for i in range(n-1,0,-1):
if n%i==0: return i
Line 1,459:
 
for i in range(1,101):
print("{:3}".format(lpd(i)), end=i%10==0 and '\n' or '')</langsyntaxhighlight>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,475:
Or, reducing the search space, formatting more flexibly (to allow for experiments with larger ranges) and composing functionally:
 
<langsyntaxhighlight lang="python">'''Largest proper divisor of'''
 
from math import isqrt
Line 1,546:
# MAIN ---
if __name__ == '__main__':
main()</langsyntaxhighlight>
{{Out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,562:
<code>factors</code> is defined at [http://rosettacode.org/wiki/Factors_of_an_integer#Quackery Factors of an integer].
 
<langsyntaxhighlight Quackerylang="quackery">' [ 1 ] 99 times
[ i^ 2 + factors
-2 peek join ]
echo</langsyntaxhighlight>
 
{{out}}
Line 1,572:
 
=={{header|R}}==
<langsyntaxhighlight Rlang="r">largest_proper_divisor <- function(n){
if(n == 1) return(1)
Line 1,590:
largest_proper_divisor(i)
}
</syntaxhighlight>
</lang>
 
{{out}}
Line 1,618:
 
Note: this example is ridiculously overpowered (and so, somewhat inefficient) for a range of 1 to 100, but will easily handle large numbers without modification.
<syntaxhighlight lang="raku" perl6line>use Prime::Factor;
 
for 0, 2**67 - 1 -> $add {
Line 1,631:
 
say (now - $start).fmt("%0.3f seconds\n");
}</langsyntaxhighlight>
{{out}}
<pre>GPD for 1 through 100:
Line 1,663:
 
This addition made it about &nbsp; '''75%''' &nbsp; faster.
<langsyntaxhighlight lang="rexx">/*REXX program finds the largest proper divisors of all numbers (up to a given limit). */
parse arg n cols . /*obtain optional argument from the CL.*/
if n=='' | n=="," then n= 101 /*Not specified? Then use the default.*/
Line 1,689:
if x//k==0 then return k /*Remainder=0? Got largest proper div.*/
end /*k*/
return 1 /*If we get here, then X is a prime.*/</langsyntaxhighlight>
{{out|output|text=&nbsp; when using the default inputs:}}
<pre>
Line 1,708:
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">? "working..."
limit = 100
? "Largest proper divisor up to " + limit + " are:"
Line 1,722:
if col++ % 10 = 0 ? "" ok
next
? "done..."</langsyntaxhighlight>
{{out}}
<pre>working...
Line 1,739:
 
=={{header|Ruby}}==
<langsyntaxhighlight lang="ruby">require 'prime'
 
def a(n)
Line 1,747:
 
(1..100).map{|n| a(n).to_s.rjust(3)}.each_slice(10){|slice| puts slice.join}
</syntaxhighlight>
</lang>
{{out}}
<pre> 1 1 1 2 1 3 1 4 3 5
Line 1,762:
 
=={{header|Seed7}}==
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
 
const func integer: largestProperDivisor (in integer: number) is func
Line 1,793:
end if;
end for;
end func;</langsyntaxhighlight>
{{out}}
<pre>
Line 1,809:
 
=={{header|Swift}}==
<langsyntaxhighlight lang="swift">import Foundation
 
func largestProperDivisor(_ n : Int) -> Int? {
Line 1,831:
print(String(format: "%2d", largestProperDivisor(n)!),
terminator: n % 10 == 0 ? "\n" : " ")
}</langsyntaxhighlight>
 
{{out}}
Line 1,850:
=={{header|True BASIC}}==
{{trans|FreeBASIC}}
<langsyntaxhighlight lang="qbasic">PRINT "El mayor divisor propio de n es:"
PRINT
PRINT " 1 1";
Line 1,862:
IF remainder(i, 10) = 0 Then PRINT
NEXT i
END</langsyntaxhighlight>
{{out}}
<pre>
Line 1,870:
=={{header|Vlang}}==
{{trans|go}}
<langsyntaxhighlight lang="vlang">fn largest_proper_divisor(n int) int {
for i := 2; i*i <= n; i++ {
if n%i == 0 {
Line 1,892:
}
}
}</langsyntaxhighlight>
 
{{out}}
Line 1,913:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
<langsyntaxhighlight lang="ecmascript">import "/math" for Int
import "/fmt" for Fmt
 
Line 1,925:
}
if (n % 10 == 0) System.print()
}</langsyntaxhighlight>
 
{{out}}
Line 1,945:
=={{header|Yabasic}}==
{{trans|FreeBASIC}}
<langsyntaxhighlight lang="yabasic">print "El mayor divisor propio de n es:\n"
print " 1 1 ";
for i = 3 to 100
Line 1,954:
next i
print
end</langsyntaxhighlight>
{{out}}
<pre>
Line 1,962:
 
=={{header|X86 Assembly}}==
<langsyntaxhighlight lang="asm"> 1 ;Assemble with: tasm, tlink /t
2 0000 .model tiny
3 0000 .code
Line 2,015:
52
53 end start
</syntaxhighlight>
</lang>
 
{{out}}
Line 2,032:
 
=={{header|XPL0}}==
<langsyntaxhighlight XPL0lang="xpl0">int N, D;
[for N:= 1 to 100 do
[D:= if N=1 then 1 else N/2;
Line 2,040:
if rem(N/10) = 0 then CrLf(0) else ChOut(0, ^ );
];
]</langsyntaxhighlight>
 
{{out}}
10,327

edits