Find the prime factors
SageMath, 31 Bytes
N=input()
print N,"=",factor(N)
Test case:
83891573479027823458394579234582347590825792034579235923475902312344444
Outputs:
83891573479027823458394579234582347590825792034579235923475902312344444 = 2^2 * 3^2 * 89395597 * 98966790508447596609239 * 263396636003096040031295425789508274613
Ruby 1.9, 74 70 characters
#!ruby -plrmathn
$_+=?=+$_.to_i.prime_division.map{|a|a[0,a[1]]*?^}*?*
Edits:
- (74 -> 70) Just use the exponent as slice length instead of explicitly checking for
exponent > 1
Perl 5.10, 73 88
perl -pe '$_=`factor $_`;s%( \d+)\K\1+%-1-length($&)/length$1%ge;y, -,*^,;s;\D+;=;'
Takes input number from standard input. Will compute factors for multiple inputs if provided.
Counted as a difference to perl -e
. 5.10 is needed for the \K
regex metacharacter.