79349153

Date: 2025-01-12 00:39:46
Score: 1
Natty:
Report link

Did you really say list of tuples by list comprehension? Okay, you're supposed to have it if you really, really have to:

n=3783780 # e.g.
print(
[(k,v)for k,v in{k:l.count(k)for l in[(lambda f,p,i:[]if i<p else f(f,p+1,i)if i%p else[p]+f(f,p,i/p))(lambda g,q,j:[]if j<q else g(g,q+1,j)if j%q else[q]+g(g,q,j/q),2,n)]for k in l}.items()]
      )

It could probably be written a little shorter. Here the core is a list of prime factors (I had that written earlier), and that was just modified into tuples of prime+exponent pairs. It would be better to generate the desired pairs directly and put them as tuples in a list, or at least in a dict and then convert that to a list.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): Did you
  • Low reputation (1):
Posted by: 1jack