Factors of an integer: Difference between revisions

m
{{out}}
m ({{out}})
m ({{out}})
Line 1:
{{Task|Basic language learning}} {{basic data operation}}
[[Category:Arithmetic operations]]
[[Category:Mathematical_operations]]
Line 130:
print(new line)
OD</lang>
{{out}}
Output:
<pre>
+45: 1, 45, 3, 15, 5, 9
Line 154:
Return, v
}</lang>
 
Output:
{{out}}
<pre>
1,3,5,9,15,45
Line 174 ⟶ 175:
Return $ls_factors&$intg
EndFunc</lang>
 
Output:
{{out}}
<pre>
Factors of 45 are: 1, 3, 5, 9, 15, 45
Line 200 ⟶ 202:
}
</lang>
 
<p>output:</p>
{{out}}
<pre>
enter a number or C/R to exit
Line 1,433 ⟶ 1,436:
</lang>
 
{{out}}
Output in the REPL:
<pre>
<lang lisp>
> (factors 10677106534462215678539721403561279)
(104729 104729 104729 98731 98731 32579 29269 1)
</langpre>
 
=={{header|Liberty BASIC}}==
Line 2,256 ⟶ 2,259:
Print(#CRLF$+#CRLF$+"Press ENTER to quit."): Input()
EndIf</lang>
 
'''Output can look like
{{out}}
<pre>
Enter integer to factorize: 96
1 2 3 4 6 8 12 16 24 32 48 96
</pre>
 
=={{header|Python}}==
Line 2,410 ⟶ 2,416:
if j*j==x then return a j b /*Was X a square? If so, add √ x */
return a b /*return all the divisors (both lists).*/</lang>
'''output''' &nbsp;{{out}} when the input used is: &nbsp; <tt> -6 &nbsp; 200 </tt>
<pre style="height:65ex">
n #divisors divisors
Line 2,713 ⟶ 2,719:
NEXT
end function</lang>
 
output
{{out}}
<pre>Factors of 45 are 1, 3, 5, 9, 15, 45,
Factors of 12345 are 1, 3, 5, 15, 823, 2469, 4115, 12345, </pre>
Line 2,768 ⟶ 2,775:
(display (factors 1111111))
(newline)</lang>
 
Output:
{{out}}
<pre>
(1 239 4649 1111111)
</pre>
 
=={{header|Seed7}}==
Line 2,803 ⟶ 2,813:
end func;</lang>
 
{{out}}
Output:
<pre>
Factors of 45: 1, 45, 3, 15, 5, 9
Line 2,906 ⟶ 2,916:
puts [factors 45]
puts [factors 53]</lang>
 
output
{{out}}
<pre>1 2 4 8 16 32 64
1 3 5 9 15 45
Line 2,941 ⟶ 2,952:
 
example = factors 100</lang>
 
output:
{{out}}
<pre><1,2,4,5,10,20,25,50,100></pre>
 
=={{header|VBA}}==
<lang VBA>Function Factors(x As Integer) As String
Line 2,997 ⟶ 3,010:
]</lang>
 
{{out}}
Example output:
<pre>
1 = 1
Anonymous user