Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#Python 2 - (削除) 254 (削除ここまで)(削除) 252 (削除ここまで)(削除) 196 (削除ここまで)(削除) 185 (削除ここまで)(削除) 156 (削除ここまで)(削除) 151 (削除ここまで)(削除) 134 (削除ここまで)(削除) 126 (削除ここまで) 121

Python 2 - (削除) 254 (削除ここまで)(削除) 252 (削除ここまで)(削除) 196 (削除ここまで)(削除) 185 (削除ここまで)(削除) 156 (削除ここまで)(削除) 151 (削除ここまで)(削除) 134 (削除ここまで)(削除) 126 (削除ここまで) 121

i=1
a,b=map(int,raw_input().split())
while b:a,b=b,a%b
while~-a:
 i+=1;j=0
 while a%i<1:j+=1;a/=i
 if j:print`i`+'^'+`j`,

Interpreter

repl.it

Example Input - stdin

100 50

Example Output - stdout

2^1 5^2

#Python 2 - (削除) 254 (削除ここまで)(削除) 252 (削除ここまで)(削除) 196 (削除ここまで)(削除) 185 (削除ここまで)(削除) 156 (削除ここまで)(削除) 151 (削除ここまで)(削除) 134 (削除ここまで)(削除) 126 (削除ここまで) 121

i=1
a,b=map(int,raw_input().split())
while b:a,b=b,a%b
while~-a:
 i+=1;j=0
 while a%i<1:j+=1;a/=i
 if j:print`i`+'^'+`j`,

Interpreter

repl.it

Example Input - stdin

100 50

Example Output - stdout

2^1 5^2

Python 2 - (削除) 254 (削除ここまで)(削除) 252 (削除ここまで)(削除) 196 (削除ここまで)(削除) 185 (削除ここまで)(削除) 156 (削除ここまで)(削除) 151 (削除ここまで)(削除) 134 (削除ここまで)(削除) 126 (削除ここまで) 121

i=1
a,b=map(int,raw_input().split())
while b:a,b=b,a%b
while~-a:
 i+=1;j=0
 while a%i<1:j+=1;a/=i
 if j:print`i`+'^'+`j`,

Interpreter

repl.it

Example Input - stdin

100 50

Example Output - stdout

2^1 5^2

added 1 character in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63

#Python 2 - (削除) 254 (削除ここまで) (削除) 252 (削除ここまで) (削除) 196 (削除ここまで) (削除) 185 (削除ここまで) (削除) 156 (削除ここまで) (削除) 151 (削除ここまで) (削除) 134 (削除ここまで) 126(削除) 126 (削除ここまで) 121

f=''
i=1
a,b=map(int,raw_input().split())
while b:a,b=b,a%b
while~-a:
 i+=1;j=0
 while a%i<1:j+=1;a/=i
 if j:print`i`+'^'+`j`,

Interpreter

repl.it

Example Input - stdin

100 50

Example Output - stdout

2^1 5^2

#Python 2 - (削除) 254 (削除ここまで) (削除) 252 (削除ここまで) (削除) 196 (削除ここまで) (削除) 185 (削除ここまで) (削除) 156 (削除ここまで) (削除) 151 (削除ここまで) (削除) 134 (削除ここまで) 126

f=''
i=1
a,b=map(int,raw_input().split())
while b:a,b=b,a%b
while~-a:
 i+=1;j=0
 while a%i<1:j+=1;a/=i
 if j:print`i`+'^'+`j`,

Interpreter

repl.it

Example Input - stdin

100 50

Example Output - stdout

2^1 5^2

#Python 2 - (削除) 254 (削除ここまで) (削除) 252 (削除ここまで) (削除) 196 (削除ここまで) (削除) 185 (削除ここまで) (削除) 156 (削除ここまで) (削除) 151 (削除ここまで) (削除) 134 (削除ここまで) (削除) 126 (削除ここまで) 121

i=1
a,b=map(int,raw_input().split())
while b:a,b=b,a%b
while~-a:
 i+=1;j=0
 while a%i<1:j+=1;a/=i
 if j:print`i`+'^'+`j`,

Interpreter

repl.it

Example Input - stdin

100 50

Example Output - stdout

2^1 5^2

added 17 characters in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63

#Python 2 - (削除) 254 (削除ここまで) (削除) 252 (削除ここまで) (削除) 196 (削除ここまで) (削除) 185 (削除ここまで) (削除) 156 (削除ここまで) (削除) 151 (削除ここまで) 134(削除) 134 (削除ここまで) 126

f=''
i=1
a,b=map(int,raw_input().split())
while b:a,b=b,a%b
while~-a:
 i+=1;j=0
 while a%i<1:j+=1;a/=i
 if j:f+='%d^%d '%(iprint`i`+'^'+`j`,j)
print f

Tested with Interpreter

repl.it .

Example Input (from stdin)Example Input - stdin

100 50

Example OutputExample Output - stdout

2^1 5^2

#Python 2 - (削除) 254 (削除ここまで) (削除) 252 (削除ここまで) (削除) 196 (削除ここまで) (削除) 185 (削除ここまで) (削除) 156 (削除ここまで) (削除) 151 (削除ここまで) 134

f=''
i=1
a,b=map(int,raw_input().split())
while b:a,b=b,a%b
while~-a:
 i+=1;j=0
 while a%i<1:j+=1;a/=i
 if j:f+='%d^%d '%(i,j)
print f

Tested with repl.it .

Example Input (from stdin)

100 50

Example Output

2^1 5^2

#Python 2 - (削除) 254 (削除ここまで) (削除) 252 (削除ここまで) (削除) 196 (削除ここまで) (削除) 185 (削除ここまで) (削除) 156 (削除ここまで) (削除) 151 (削除ここまで) (削除) 134 (削除ここまで) 126

f=''
i=1
a,b=map(int,raw_input().split())
while b:a,b=b,a%b
while~-a:
 i+=1;j=0
 while a%i<1:j+=1;a/=i
 if j:print`i`+'^'+`j`,

Interpreter

repl.it

Example Input - stdin

100 50

Example Output - stdout

2^1 5^2

deleted 35 characters in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63
Loading
deleted 35 characters in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63
Loading
added 6 characters in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63
Loading
added 76 characters in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63
Loading
added 6 characters in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63
Loading
added 15 characters in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63
Loading
deleted 81 characters in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63
Loading
added 3 characters in body
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63
Loading
Source Link
Rainbolt
  • 6.4k
  • 6
  • 34
  • 63
Loading

AltStyle によって変換されたページ (->オリジナル) /