+ 3

Help me please for prime number for example;

input 280 output 280=2(3)5(1)7(1)

11th Jan 2017, 8:02 PM
Zahra Zaker Dehnavi
Zahra Zaker Dehnavi - avatar
8 Réponses
+ 3
underestand n=int(input()) m=n f=2 c={} while n>1: i=1 while n%f==0: c.update({f:i}) n=n/f i+=1 f+=1 print (m,end="=") for i in c: print ('{}({})'.format(i,c[i]),end='')
13th Jan 2017, 4:40 PM
Zahra Zaker Dehnavi
Zahra Zaker Dehnavi - avatar
+ 2
280 2**3=8 \ 5**1=5 /=8*5*7=280 7**1=7/
12th Jan 2017, 12:02 PM
Zahra Zaker Dehnavi
Zahra Zaker Dehnavi - avatar
+ 1
what are you having trouble with? Logic? If so, start by looking at how you calculate the factors, and see how to put it in a loop, for starters - then make it recursive. if you are really stuck, this gives basic logic using loops https://code.sololearn.com/cq7rD6Z9Pjz3
11th Jan 2017, 10:34 PM
Renata
+ 1
Okay I sent it. Good luck!
12th Jan 2017, 3:20 PM
ramzi
ramzi - avatar
+ 1
Hi Zahra, we have a group in telegram about programming, if you need or have beatiful code, you can join us : https://t.me/joinchat/AAAAAEDCX-6muhj7yLF5jw
9th Feb 2017, 1:42 PM
Mohammad Zarchi
Mohammad Zarchi - avatar
0
can you give other output exemples?
12th Jan 2017, 9:49 AM
ramzi
ramzi - avatar
0
can you send me an email address where I can send you the program I just did? I included commentaries so you can understand easier
12th Jan 2017, 12:32 PM
ramzi
ramzi - avatar
0
correct!
13th Jan 2017, 7:35 PM
ramzi
ramzi - avatar