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

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Climb a step to a prime

The title of Numberphile's newest video, 13532385396179, is a fixed point of the following function \$f\$ on the positive integers:

Let \$n\$ be a positive integer. Write the prime factorization in the usual way, e.g. \60ドル = 2^2 \cdot 3 \cdot 5\$, in which the primes are written in increasing order, and exponents of 1 are omitted. Then bring exponents down to the line and omit all multiplication signs, obtaining a number \$f(n)\$. [...] for example, \$f(60) = f(2^2 \cdot 3 \cdot 5) = 2235\$.

(The above definition is taken from Problem 5 of Five 1,000ドル Problems - John H. Conway)

Note that \$f(13532385396179) = f(13 \cdot 53^2 \cdot 3853 \cdot 96179) = 13532385396179\$.

Task

Take a positive composite integer \$n\$ as input, and output \$f(n)\$.

Another example

\48ドル = 2^4 \cdot 3\$, so \$f (48) = 243\$.

Testcases

More testcases are available here.

 4 -> 22
 6 -> 23
 8 -> 23
 48 -> 243
 52 -> 2213
 60 -> 2235
 999 -> 3337
9999 -> 3211101

Answer*

Draft saved
Draft discarded
Cancel
5
  • \$\begingroup\$ V = "concatenate to a single string and eval as Jelly" \$\endgroup\$ Commented Jun 9, 2017 at 10:48
  • \$\begingroup\$ @EriktheOutgolfer Yes, hence "effectively". \$\endgroup\$ Commented Jun 9, 2017 at 10:49
  • \$\begingroup\$ @MartinEnder Any particular reason you don't use (Convert from decimal to integer)? \$\endgroup\$ Commented Jul 3, 2017 at 19:00
  • \$\begingroup\$ @Christian Because the list might contain multi-digit integers. \$\endgroup\$ Commented Jul 3, 2017 at 19:26
  • \$\begingroup\$ @MartinEnder Ah, clever. I've used FḌ in the past - that's a good tip! \$\endgroup\$ Commented Jul 4, 2017 at 0:18

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