Multiplicative persistence












37












$begingroup$


Multiplicative Persistence




  1. Multiply all the digits in a number

  2. Repeat until you have a single digit left


As explained by Numberphile:





  • Numberphile "What's special about 277777788888899?"


  • Numberphile "Multiplicative Persistence (extra footage)"


Example




  1. 277777788888899 → 2x7x7x7x7x7x7x8x8x8x8x8x8x9x9 = 4996238671872

  2. 4996238671872 → 4x9x9x6x2x3x8x6x7x1x8x7x2 = 438939648

  3. 438939648 → 4x3x8x9x3x9x6x4x8 = 4478976

  4. 4478976 → 4x4x7x8x9x7x6 = 338688

  5. 338688 → 3x3x8x6x8x8 = 27648

  6. 27648 → 2x7x6x4x8 = 2688

  7. 2688 → 2x6x8x8 = 768

  8. 768 → 7x6x8 = 336

  9. 336 → 3x3x6 = 54

  10. 54 → 5x4 = 20

  11. 20 → 2x0 = 0


This is the current record, by the way: the smallest number with the largest number of steps.



Golf



A program that takes any whole number as input and then outputs the result of each step, starting with the input itself, until we hit a single digit. For 277777788888899 the output should be



277777788888899
4996238671872
438939648
4478976
338688
27648
2688
768
336
54
20
0


(Counting the number of steps is left as an exercise to the user).



More Examples



From A003001:



25
10
0


From A003001 as well:



68889
27648
2688
768
336
54
20
0


From the Numberphile video:



327
42
8




So there has been a question about Additive Persistence, but this is Multiplicative Persistence. Also, that question asks for the number of steps as output, while I'm interested in seeing the intermediate results.










share|improve this question











$endgroup$












  • $begingroup$
    Bonus: find a new record: smallest number with the largest number of steps. Caveat: conjecture has it that 11 is the largest possible.
    $endgroup$
    – SQB
    yesterday






  • 7




    $begingroup$
    You probably should include a few more tests cases that do not end with $0$.
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    Came to make this post, found it already existing, gg
    $endgroup$
    – cat
    yesterday










  • $begingroup$
    is a single digit valid input?
    $endgroup$
    – dzaima
    yesterday






  • 1




    $begingroup$
    In the Numberphile video, Matt Parker states that searches have been done to several hundred digits.
    $endgroup$
    – HardScale
    yesterday
















37












$begingroup$


Multiplicative Persistence




  1. Multiply all the digits in a number

  2. Repeat until you have a single digit left


As explained by Numberphile:





  • Numberphile "What's special about 277777788888899?"


  • Numberphile "Multiplicative Persistence (extra footage)"


Example




  1. 277777788888899 → 2x7x7x7x7x7x7x8x8x8x8x8x8x9x9 = 4996238671872

  2. 4996238671872 → 4x9x9x6x2x3x8x6x7x1x8x7x2 = 438939648

  3. 438939648 → 4x3x8x9x3x9x6x4x8 = 4478976

  4. 4478976 → 4x4x7x8x9x7x6 = 338688

  5. 338688 → 3x3x8x6x8x8 = 27648

  6. 27648 → 2x7x6x4x8 = 2688

  7. 2688 → 2x6x8x8 = 768

  8. 768 → 7x6x8 = 336

  9. 336 → 3x3x6 = 54

  10. 54 → 5x4 = 20

  11. 20 → 2x0 = 0


This is the current record, by the way: the smallest number with the largest number of steps.



Golf



A program that takes any whole number as input and then outputs the result of each step, starting with the input itself, until we hit a single digit. For 277777788888899 the output should be



277777788888899
4996238671872
438939648
4478976
338688
27648
2688
768
336
54
20
0


(Counting the number of steps is left as an exercise to the user).



More Examples



From A003001:



25
10
0


From A003001 as well:



68889
27648
2688
768
336
54
20
0


From the Numberphile video:



327
42
8




So there has been a question about Additive Persistence, but this is Multiplicative Persistence. Also, that question asks for the number of steps as output, while I'm interested in seeing the intermediate results.










share|improve this question











$endgroup$












  • $begingroup$
    Bonus: find a new record: smallest number with the largest number of steps. Caveat: conjecture has it that 11 is the largest possible.
    $endgroup$
    – SQB
    yesterday






  • 7




    $begingroup$
    You probably should include a few more tests cases that do not end with $0$.
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    Came to make this post, found it already existing, gg
    $endgroup$
    – cat
    yesterday










  • $begingroup$
    is a single digit valid input?
    $endgroup$
    – dzaima
    yesterday






  • 1




    $begingroup$
    In the Numberphile video, Matt Parker states that searches have been done to several hundred digits.
    $endgroup$
    – HardScale
    yesterday














37












37








37


4



$begingroup$


Multiplicative Persistence




  1. Multiply all the digits in a number

  2. Repeat until you have a single digit left


As explained by Numberphile:





  • Numberphile "What's special about 277777788888899?"


  • Numberphile "Multiplicative Persistence (extra footage)"


Example




  1. 277777788888899 → 2x7x7x7x7x7x7x8x8x8x8x8x8x9x9 = 4996238671872

  2. 4996238671872 → 4x9x9x6x2x3x8x6x7x1x8x7x2 = 438939648

  3. 438939648 → 4x3x8x9x3x9x6x4x8 = 4478976

  4. 4478976 → 4x4x7x8x9x7x6 = 338688

  5. 338688 → 3x3x8x6x8x8 = 27648

  6. 27648 → 2x7x6x4x8 = 2688

  7. 2688 → 2x6x8x8 = 768

  8. 768 → 7x6x8 = 336

  9. 336 → 3x3x6 = 54

  10. 54 → 5x4 = 20

  11. 20 → 2x0 = 0


This is the current record, by the way: the smallest number with the largest number of steps.



Golf



A program that takes any whole number as input and then outputs the result of each step, starting with the input itself, until we hit a single digit. For 277777788888899 the output should be



277777788888899
4996238671872
438939648
4478976
338688
27648
2688
768
336
54
20
0


(Counting the number of steps is left as an exercise to the user).



More Examples



From A003001:



25
10
0


From A003001 as well:



68889
27648
2688
768
336
54
20
0


From the Numberphile video:



327
42
8




So there has been a question about Additive Persistence, but this is Multiplicative Persistence. Also, that question asks for the number of steps as output, while I'm interested in seeing the intermediate results.










share|improve this question











$endgroup$




Multiplicative Persistence




  1. Multiply all the digits in a number

  2. Repeat until you have a single digit left


As explained by Numberphile:





  • Numberphile "What's special about 277777788888899?"


  • Numberphile "Multiplicative Persistence (extra footage)"


Example




  1. 277777788888899 → 2x7x7x7x7x7x7x8x8x8x8x8x8x9x9 = 4996238671872

  2. 4996238671872 → 4x9x9x6x2x3x8x6x7x1x8x7x2 = 438939648

  3. 438939648 → 4x3x8x9x3x9x6x4x8 = 4478976

  4. 4478976 → 4x4x7x8x9x7x6 = 338688

  5. 338688 → 3x3x8x6x8x8 = 27648

  6. 27648 → 2x7x6x4x8 = 2688

  7. 2688 → 2x6x8x8 = 768

  8. 768 → 7x6x8 = 336

  9. 336 → 3x3x6 = 54

  10. 54 → 5x4 = 20

  11. 20 → 2x0 = 0


This is the current record, by the way: the smallest number with the largest number of steps.



Golf



A program that takes any whole number as input and then outputs the result of each step, starting with the input itself, until we hit a single digit. For 277777788888899 the output should be



277777788888899
4996238671872
438939648
4478976
338688
27648
2688
768
336
54
20
0


(Counting the number of steps is left as an exercise to the user).



More Examples



From A003001:



25
10
0


From A003001 as well:



68889
27648
2688
768
336
54
20
0


From the Numberphile video:



327
42
8




So there has been a question about Additive Persistence, but this is Multiplicative Persistence. Also, that question asks for the number of steps as output, while I'm interested in seeing the intermediate results.







code-golf math arithmetic repeated-transformation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 22 hours ago







SQB

















asked yesterday









SQBSQB

466314




466314












  • $begingroup$
    Bonus: find a new record: smallest number with the largest number of steps. Caveat: conjecture has it that 11 is the largest possible.
    $endgroup$
    – SQB
    yesterday






  • 7




    $begingroup$
    You probably should include a few more tests cases that do not end with $0$.
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    Came to make this post, found it already existing, gg
    $endgroup$
    – cat
    yesterday










  • $begingroup$
    is a single digit valid input?
    $endgroup$
    – dzaima
    yesterday






  • 1




    $begingroup$
    In the Numberphile video, Matt Parker states that searches have been done to several hundred digits.
    $endgroup$
    – HardScale
    yesterday


















  • $begingroup$
    Bonus: find a new record: smallest number with the largest number of steps. Caveat: conjecture has it that 11 is the largest possible.
    $endgroup$
    – SQB
    yesterday






  • 7




    $begingroup$
    You probably should include a few more tests cases that do not end with $0$.
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    Came to make this post, found it already existing, gg
    $endgroup$
    – cat
    yesterday










  • $begingroup$
    is a single digit valid input?
    $endgroup$
    – dzaima
    yesterday






  • 1




    $begingroup$
    In the Numberphile video, Matt Parker states that searches have been done to several hundred digits.
    $endgroup$
    – HardScale
    yesterday
















$begingroup$
Bonus: find a new record: smallest number with the largest number of steps. Caveat: conjecture has it that 11 is the largest possible.
$endgroup$
– SQB
yesterday




$begingroup$
Bonus: find a new record: smallest number with the largest number of steps. Caveat: conjecture has it that 11 is the largest possible.
$endgroup$
– SQB
yesterday




7




7




$begingroup$
You probably should include a few more tests cases that do not end with $0$.
$endgroup$
– Arnauld
yesterday




$begingroup$
You probably should include a few more tests cases that do not end with $0$.
$endgroup$
– Arnauld
yesterday












$begingroup$
Came to make this post, found it already existing, gg
$endgroup$
– cat
yesterday




$begingroup$
Came to make this post, found it already existing, gg
$endgroup$
– cat
yesterday












$begingroup$
is a single digit valid input?
$endgroup$
– dzaima
yesterday




$begingroup$
is a single digit valid input?
$endgroup$
– dzaima
yesterday




1




1




$begingroup$
In the Numberphile video, Matt Parker states that searches have been done to several hundred digits.
$endgroup$
– HardScale
yesterday




$begingroup$
In the Numberphile video, Matt Parker states that searches have been done to several hundred digits.
$endgroup$
– HardScale
yesterday










41 Answers
41






active

oldest

votes













1 2
next












11












$begingroup$


K (ngn/k), 9 bytes



{*/.'$x}


Try it online!



{ } keep applying the function in curly braces until the sequence converges



$x format the argument as a string (list of characters)



.' evaluate each (other dialects of k require a colon, .:')



*/ times over, i.e. product






share|improve this answer











$endgroup$





















    9












    $begingroup$

    TI-BASIC (TI-84), 30 32 bytes



    While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans


    Input is in Ans.

    Output is displayed as the challenge requests. The trailing Ans is needed to print the last step.



    I will admit, I did not think of this formula myself, rather I found it here and modified it to better fit the challenge.



    EDIT: Upon rereading the challenge, I realized that the program must terminate if the product is one digit. Hence, 2 bytes were to be added to account for this.



    Example:



    24456756
    24456756
    prgmCDGF8
    24456756
    201600
    0
    11112
    11112
    prgmCDGF8
    11112
    2


    Explanation:



    While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans  ;full program

    While Ans>9 End ;loop until the product is one digit
    Disp Ans ;print the current number
    prod( ;get the product of
    seq( ;the list generated by
    10^(-X-1), ;consecutive powers of ten
    X, ;using X as the increment variable
    0, ;starting at 0
    log(Ans ;ending at the length of the current number
    ;(implicit increment by 1)
    Ans ;multiplied by the current number
    fPart( ;then taking the fractional part of each element
    10 ;multiplied by 10
    int( ;then truncating each element
    Ans ;output last step since it was skipped




    Notes:



    TI-BASIC is a tokenized language. Character count does not equal byte count.



    10^( is this one-byte token.



    This program will not provide the correct sequence of products with integers greater than 14 digits long due to the limitations of decimal precision on the TI calculators.






    share|improve this answer











    $endgroup$





















      8












      $begingroup$


      dzaima/APL, 14 11 bytes



      ∪{×/⍎¨⍕⍵}⍡≡


      Try it online!






      share|improve this answer











      $endgroup$













      • $begingroup$
        is really needed?
        $endgroup$
        – ngn
        yesterday






      • 2




        $begingroup$
        @ngn yep. Without it, there are two equal answers at the end, and it's been stated in the comments that a single digit must return a single digit
        $endgroup$
        – dzaima
        yesterday










      • $begingroup$
        understood­­­­­
        $endgroup$
        – ngn
        yesterday



















      8












      $begingroup$


      R, 59 bytes





      n=scan();while(print(n)>9)n=prod(n%/%10^(nchar(n):1-1)%%10)


      Try it online!



      Since print invisibly returns its input, we can use print(n) inside the while loop to simulate a do-while loop. This is inspired by one of my tips for golfing in R.



      The header helps prevent large numbers from being printed in scientific notation.






      share|improve this answer











      $endgroup$





















        7












        $begingroup$


        05AB1E, 7 4 bytes



        Δ=SP


        Try it online or verify all test cases.



        Explanation:





        Δ     # Loop until the number no longer changes:
        = # Print the number with trailing newline (without popping the number itself)
        # (which will be the implicit input in the first iteration)
        SP # Convert the number to a list of digits, and calculate its product





        share|improve this answer











        $endgroup$





















          6












          $begingroup$


          Wolfram Language (Mathematica), 47 bytes



          Most@FixedPointList[Times@@IntegerDigits@#&,#]&


          Try it online!






          share|improve this answer









          $endgroup$





















            6












            $begingroup$


            Perl 6, 23 bytes





            {$_,{[*] .comb}…10>*}


            Try it online!






            share|improve this answer









            $endgroup$





















              6












              $begingroup$


              Python 2,  46  43 bytes





              -3 thanks to xnor (chained comparison)



              def f(n):print n;n>9>f(eval('*'.join(`n`)))


              Try it online!






              share|improve this answer











              $endgroup$













              • $begingroup$
                You can do > in place of and.
                $endgroup$
                – xnor
                yesterday










              • $begingroup$
                @xnor thanks, easy to forget that will work.
                $endgroup$
                – Jonathan Allan
                22 hours ago



















              5












              $begingroup$


              Julia 0.7, 36 bytes





              f(n)=n>9?[n,f(prod(digits(n)))...]:n


              Try it online!






              share|improve this answer









              $endgroup$





















                5












                $begingroup$


                PowerShell, 54 bytes





                for($a=$args;$a-gt9){$a;$a=("$a"|% t*y)-join"*"|iex}$a


                Try it online!





                Iterative method that first writes the input argument, then converts it into a string and pipes it into a character array. This array is joined by a single asterisks, and executed as a command with the invoke expression alias. Since this writes Starting number down to the last number greater than 0, (20, in the given test scenario), I add a final $a to the end to output.






                share|improve this answer











                $endgroup$





















                  5












                  $begingroup$


                  Python 2, 61 62 59 bytes





                  def f(n):print n;n>9and f(reduce(int.__mul__,map(int,`n`)))


                  Try it online!



                  -3 bytes, thanks to Jonathan Allan






                  share|improve this answer











                  $endgroup$













                  • $begingroup$
                    Doesn't work for inputs that don't end with a 0 on their last iteration, for example 23
                    $endgroup$
                    – Embodiment of Ignorance
                    yesterday










                  • $begingroup$
                    @EmbodimentofIgnorance Fixed :)
                    $endgroup$
                    – TFeld
                    yesterday










                  • $begingroup$
                    int.__mul__ is three bytes less than lambda a,b:a*b
                    $endgroup$
                    – Jonathan Allan
                    yesterday










                  • $begingroup$
                    @JonathanAllan Thanks! I knew there had to be something like that
                    $endgroup$
                    – TFeld
                    yesterday










                  • $begingroup$
                    Change f(reduce(int.__mul__,map(int,`n`))) to f(eval('*'.join(`n`))) to save 13 bytes.
                    $endgroup$
                    – mypetlion
                    yesterday





















                  5












                  $begingroup$


                  Jelly, 4 bytes



                  DP$Ƭ


                  Try it online!



                  Explanation



                  D    | convert to decimal digits
                  P | take the product
                  $ | previous two links as a monad
                  Ƭ | loop until no change, collecting all intermediate results


                  As a bonus, here's a TIO which will find the numbers with the largest number of steps for a given range of numbers of digits. It scales well even on TIO.






                  share|improve this answer











                  $endgroup$





















                    5












                    $begingroup$

                    perl 5 (-n -M5.01), 32 30 25 bytes



                    say$_=eval;s/B/*/g&&redo


                    25 bytes



                    30 bytes



                    32 bytes






                    share|improve this answer











                    $endgroup$













                    • $begingroup$
                      You should mention that this uses -lpF//
                      $endgroup$
                      – Grimy
                      21 hours ago










                    • $begingroup$
                      @Grimy i could save 2 bytes without using -lpF//, updating
                      $endgroup$
                      – Nahuel Fouilleul
                      21 hours ago



















                    5












                    $begingroup$


                    MathGolf, 9 10 bytes



                    h(ôo▒ε*h(→


                    Try it online!



                    Now it correctly handles inputs that are single digits. Not perfect, but at least it is correct.



                    Explanation



                    h(            check length of input number and decrease by 1
                    ö → while true with pop using the next 6 operators
                    p print with newline
                    ▒ split to list of chars/digits
                    ε* reduce list by multiplication
                    h( length of TOS without popping, subtracted by 1 (exits when len(TOS) == 1)





                    share|improve this answer











                    $endgroup$













                    • $begingroup$
                      The output for a single digit input should be one copy of the number - clarified in the comments
                      $endgroup$
                      – dzaima
                      yesterday










                    • $begingroup$
                      @dzaima I'll look into it, and update the answer when it's solved
                      $endgroup$
                      – maxb
                      22 hours ago



















                    4












                    $begingroup$

                    JavaScript (ES6), 45 bytes



                    Returns an array of integers.





                    f=n=>[n,...n>9?f(eval([...n+''].join`*`)):]


                    Try it online!






                    share|improve this answer











                    $endgroup$





















                      4












                      $begingroup$


                      Wolfram Language (Mathematica), 45 bytes



                      #//.x_/;x>9:>Times@@IntegerDigits@x&&Print@x&


                      Try it online!






                      share|improve this answer









                      $endgroup$





















                        4












                        $begingroup$


                        PowerShell, 51 bytes





                        filter f{$_
                        if($_-gt9){("$_"|% t*y)-join'*'|iex|f}}


                        Try it online!






                        share|improve this answer









                        $endgroup$





















                          4












                          $begingroup$


                          C# (Visual C# Interactive Compiler), 79 74 68 bytes





                          void f(int a){Print(a);if(a>9)f((a+"").Aggregate(1,(j,k)=>k%48*j));}


                          I try to stay away from recursion in C# due to how long the method declaration is, but in this case it saves compared to a loop.



                          Try it online!






                          share|improve this answer











                          $endgroup$





















                            4












                            $begingroup$

                            Haskell, 45 bytes



                            f n=n:[x|n>9,x<-f$product$read.pure<$>show n]


                            Try it online!






                            share|improve this answer









                            $endgroup$





















                              4












                              $begingroup$


                              PHP, 63 bytes





                              <?=$n=$argn;while($n>9)echo"
                              ",$n=array_product(str_split($n));


                              Iterative version, call with php -nF input from STDIN.



                              Try it online!




                              PHP, 72 71 bytes





                              function h($n){echo"$n
                              ",($n=array_product(str_split($n)))>9?h($n):$n;}


                              Try it online!



                              Recursive version, as function.



                              Input: 277777788888899



                              277777788888899
                              4996238671872
                              438939648
                              4478976
                              338688
                              27648
                              2688
                              768
                              336
                              54
                              20
                              0


                              Input: 23



                              23
                              6





                              share|improve this answer











                              $endgroup$





















                                4












                                $begingroup$


                                J, 16 bytes



                                ([:*/,.&.":)^:a:


                                Try it online!






                                share|improve this answer









                                $endgroup$





















                                  4












                                  $begingroup$


                                  Ruby, 38 35 34 bytes





                                  f=->n{p(n)>9&&f[eval n.digits*?*]}


                                  Try it online!



                                  1 byte saved by by G B.






                                  share|improve this answer











                                  $endgroup$





















                                    3












                                    $begingroup$


                                    Brachylog, 7 bytes



                                    ẉ?Ḋ|ẹ×↰


                                    Try it online!



                                    Explanation



                                    ẉ          Write the input followed by a linebreak
                                    ?Ḋ If the input is a single digit, then it's over
                                    | Otherwise
                                    ẹ Split the input into a list of digits
                                    × Multiply them together
                                    ↰ Recursive call with the result of the multiplication as input





                                    share|improve this answer









                                    $endgroup$













                                    • $begingroup$
                                      I gave it a try myself. Forgot about the Ḋ. The rest i had the same.
                                      $endgroup$
                                      – Kroppeb
                                      yesterday





















                                    3












                                    $begingroup$


                                    JavaScript (Babel Node), 46 bytes





                                    f=a=>a>9?[a,...f(eval([...a+''].join`*`))]:[a]


                                    Try it online!






                                    JavaScript (Babel Node), 44 bytes



                                    If the input can be taken as String





                                    f=a=>a>9?[a,...f(''+eval([...a].join`*`))]:a


                                    Try it online!






                                    share|improve this answer











                                    $endgroup$













                                    • $begingroup$
                                      @Arnauld Yes, I just edited and added the wrong code. Im still looking for something using only strings instead arrays
                                      $endgroup$
                                      – Luis felipe De jesus Munoz
                                      yesterday



















                                    3












                                    $begingroup$


                                    PowerShell, 64 59 bytes





                                    for($a="$args";9-lt$a){$a;$a="$(($a|% t*y)-join'*'|iex)"}$a


                                    Try it online!



                                    Iterative method. Takes input and stores it into $a, then enters a for loop so long as the length of $a is two or more (i.e., it's bigger than 9). Inside the loop we output $a and then recalculate it by converting it toCharArray, joining it together with *, and then iex (short for Invoke-Expression and similar to eval). Once we're out of the loop, we have a single digit left to print, so we place $a onto the pipeline again.



                                    -5 bytes thanks to KGlasier.






                                    share|improve this answer











                                    $endgroup$













                                    • $begingroup$
                                      You could use the comparison 9-lt$a instead of $a.length-1 to save 5 bytes. And if you didn't go string based the whole time you could cut off a decent chunk. Check out my powershell attempt if you want!
                                      $endgroup$
                                      – KGlasier
                                      yesterday



















                                    3












                                    $begingroup$

                                    APL(NARS), 19 chars, 38 bytes



                                    {⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}


                                    test:



                                       f←{⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}
                                    f 23
                                    23
                                    6
                                    f 27648
                                    27648
                                    2688
                                    768
                                    336
                                    54
                                    20
                                    0





                                    share|improve this answer









                                    $endgroup$





















                                      3












                                      $begingroup$


                                      Charcoal, 13 bytes



                                      θW⊖Lθ«≔IΠθθ⸿θ


                                      Try it online! Link is to verbose version of code. Explanation:



                                      θ


                                      Print the input for the first time.



                                      W⊖Lθ«


                                      Repeat while the length of the input is not 1.



                                      ≔IΠθθ


                                      Replace the input with its digital product cast to string.



                                      ⸿θ


                                      Print the input on a new line.






                                      share|improve this answer









                                      $endgroup$





















                                        2












                                        $begingroup$


                                        Retina, 24 bytes



                                        .+~(`

                                        .
                                        $&$*
                                        ^
                                        .+¶$$.(


                                        Try it online! Explanation:



                                        .+~(`


                                        Print the current value on its own line at the start of every loop until it stops changing and don't print the unchanged value twice. Evaluate the current value at the end of each loop.



                                        .
                                        $&$*


                                        Add a * after each digit.



                                        ^
                                        .+¶$$.(


                                        Finish turning the input into an expression that evaluates to the digital product.



                                        Just for the record, Retina can do this in one line (25 bytes):



                                        .+"¶"<~[".+¶$.("|'*]'*L`.





                                        share|improve this answer









                                        $endgroup$





















                                          2












                                          $begingroup$

                                          Java, 112 bytes



                                          "Lossy conversion" thanks Java for the extra ~15 bytes


                                          Obligatory stream abuse recursion answer



                                          long f(long n){System.out.println(n);return n<10?n:f((n+"").chars().mapToLong(i->i).reduce(1,(x,y)->x*(y-48)));}


                                          Try it online






                                          share|improve this answer









                                          $endgroup$













                                          • $begingroup$
                                            I'm pretty sure you only need to support int
                                            $endgroup$
                                            – Embodiment of Ignorance
                                            5 hours ago



















                                          2












                                          $begingroup$

                                          Swift, 115 bytes



                                          func m(a:Int){
                                          print("(a)")
                                          var b=1,c=a
                                          while c>0{
                                          b*=c%10
                                          c/=10}
                                          b>9 ? m(a:b):print("(b)")}
                                          m(a:277777788888899)


                                          Try it online!






                                          share|improve this answer









                                          $endgroup$









                                          • 1




                                            $begingroup$
                                            I think you can move the call to m into the Footer portion of TIO, leaving this answer as 95 bytes
                                            $endgroup$
                                            – Giuseppe
                                            yesterday















                                          1 2
                                          next



                                          Your Answer





                                          StackExchange.ifUsing("editor", function () {
                                          return StackExchange.using("mathjaxEditing", function () {
                                          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                                          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                                          });
                                          });
                                          }, "mathjax-editing");

                                          StackExchange.ifUsing("editor", function () {
                                          StackExchange.using("externalEditor", function () {
                                          StackExchange.using("snippets", function () {
                                          StackExchange.snippets.init();
                                          });
                                          });
                                          }, "code-snippets");

                                          StackExchange.ready(function() {
                                          var channelOptions = {
                                          tags: "".split(" "),
                                          id: "200"
                                          };
                                          initTagRenderer("".split(" "), "".split(" "), channelOptions);

                                          StackExchange.using("externalEditor", function() {
                                          // Have to fire editor after snippets, if snippets enabled
                                          if (StackExchange.settings.snippets.snippetsEnabled) {
                                          StackExchange.using("snippets", function() {
                                          createEditor();
                                          });
                                          }
                                          else {
                                          createEditor();
                                          }
                                          });

                                          function createEditor() {
                                          StackExchange.prepareEditor({
                                          heartbeatType: 'answer',
                                          autoActivateHeartbeat: false,
                                          convertImagesToLinks: false,
                                          noModals: true,
                                          showLowRepImageUploadWarning: true,
                                          reputationToPostImages: null,
                                          bindNavPrevention: true,
                                          postfix: "",
                                          imageUploader: {
                                          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                                          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                                          allowUrls: true
                                          },
                                          onDemand: true,
                                          discardSelector: ".discard-answer"
                                          ,immediatelyShowMarkdownHelp:true
                                          });


                                          }
                                          });














                                          draft saved

                                          draft discarded


















                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181958%2fmultiplicative-persistence%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown

























                                          41 Answers
                                          41






                                          active

                                          oldest

                                          votes








                                          41 Answers
                                          41






                                          active

                                          oldest

                                          votes









                                          active

                                          oldest

                                          votes






                                          active

                                          oldest

                                          votes








                                          1 2
                                          next










                                          11












                                          $begingroup$


                                          K (ngn/k), 9 bytes



                                          {*/.'$x}


                                          Try it online!



                                          { } keep applying the function in curly braces until the sequence converges



                                          $x format the argument as a string (list of characters)



                                          .' evaluate each (other dialects of k require a colon, .:')



                                          */ times over, i.e. product






                                          share|improve this answer











                                          $endgroup$


















                                            11












                                            $begingroup$


                                            K (ngn/k), 9 bytes



                                            {*/.'$x}


                                            Try it online!



                                            { } keep applying the function in curly braces until the sequence converges



                                            $x format the argument as a string (list of characters)



                                            .' evaluate each (other dialects of k require a colon, .:')



                                            */ times over, i.e. product






                                            share|improve this answer











                                            $endgroup$
















                                              11












                                              11








                                              11





                                              $begingroup$


                                              K (ngn/k), 9 bytes



                                              {*/.'$x}


                                              Try it online!



                                              { } keep applying the function in curly braces until the sequence converges



                                              $x format the argument as a string (list of characters)



                                              .' evaluate each (other dialects of k require a colon, .:')



                                              */ times over, i.e. product






                                              share|improve this answer











                                              $endgroup$




                                              K (ngn/k), 9 bytes



                                              {*/.'$x}


                                              Try it online!



                                              { } keep applying the function in curly braces until the sequence converges



                                              $x format the argument as a string (list of characters)



                                              .' evaluate each (other dialects of k require a colon, .:')



                                              */ times over, i.e. product







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited 15 hours ago

























                                              answered yesterday









                                              ngnngn

                                              7,29112560




                                              7,29112560























                                                  9












                                                  $begingroup$

                                                  TI-BASIC (TI-84), 30 32 bytes



                                                  While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans


                                                  Input is in Ans.

                                                  Output is displayed as the challenge requests. The trailing Ans is needed to print the last step.



                                                  I will admit, I did not think of this formula myself, rather I found it here and modified it to better fit the challenge.



                                                  EDIT: Upon rereading the challenge, I realized that the program must terminate if the product is one digit. Hence, 2 bytes were to be added to account for this.



                                                  Example:



                                                  24456756
                                                  24456756
                                                  prgmCDGF8
                                                  24456756
                                                  201600
                                                  0
                                                  11112
                                                  11112
                                                  prgmCDGF8
                                                  11112
                                                  2


                                                  Explanation:



                                                  While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans  ;full program

                                                  While Ans>9 End ;loop until the product is one digit
                                                  Disp Ans ;print the current number
                                                  prod( ;get the product of
                                                  seq( ;the list generated by
                                                  10^(-X-1), ;consecutive powers of ten
                                                  X, ;using X as the increment variable
                                                  0, ;starting at 0
                                                  log(Ans ;ending at the length of the current number
                                                  ;(implicit increment by 1)
                                                  Ans ;multiplied by the current number
                                                  fPart( ;then taking the fractional part of each element
                                                  10 ;multiplied by 10
                                                  int( ;then truncating each element
                                                  Ans ;output last step since it was skipped




                                                  Notes:



                                                  TI-BASIC is a tokenized language. Character count does not equal byte count.



                                                  10^( is this one-byte token.



                                                  This program will not provide the correct sequence of products with integers greater than 14 digits long due to the limitations of decimal precision on the TI calculators.






                                                  share|improve this answer











                                                  $endgroup$


















                                                    9












                                                    $begingroup$

                                                    TI-BASIC (TI-84), 30 32 bytes



                                                    While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans


                                                    Input is in Ans.

                                                    Output is displayed as the challenge requests. The trailing Ans is needed to print the last step.



                                                    I will admit, I did not think of this formula myself, rather I found it here and modified it to better fit the challenge.



                                                    EDIT: Upon rereading the challenge, I realized that the program must terminate if the product is one digit. Hence, 2 bytes were to be added to account for this.



                                                    Example:



                                                    24456756
                                                    24456756
                                                    prgmCDGF8
                                                    24456756
                                                    201600
                                                    0
                                                    11112
                                                    11112
                                                    prgmCDGF8
                                                    11112
                                                    2


                                                    Explanation:



                                                    While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans  ;full program

                                                    While Ans>9 End ;loop until the product is one digit
                                                    Disp Ans ;print the current number
                                                    prod( ;get the product of
                                                    seq( ;the list generated by
                                                    10^(-X-1), ;consecutive powers of ten
                                                    X, ;using X as the increment variable
                                                    0, ;starting at 0
                                                    log(Ans ;ending at the length of the current number
                                                    ;(implicit increment by 1)
                                                    Ans ;multiplied by the current number
                                                    fPart( ;then taking the fractional part of each element
                                                    10 ;multiplied by 10
                                                    int( ;then truncating each element
                                                    Ans ;output last step since it was skipped




                                                    Notes:



                                                    TI-BASIC is a tokenized language. Character count does not equal byte count.



                                                    10^( is this one-byte token.



                                                    This program will not provide the correct sequence of products with integers greater than 14 digits long due to the limitations of decimal precision on the TI calculators.






                                                    share|improve this answer











                                                    $endgroup$
















                                                      9












                                                      9








                                                      9





                                                      $begingroup$

                                                      TI-BASIC (TI-84), 30 32 bytes



                                                      While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans


                                                      Input is in Ans.

                                                      Output is displayed as the challenge requests. The trailing Ans is needed to print the last step.



                                                      I will admit, I did not think of this formula myself, rather I found it here and modified it to better fit the challenge.



                                                      EDIT: Upon rereading the challenge, I realized that the program must terminate if the product is one digit. Hence, 2 bytes were to be added to account for this.



                                                      Example:



                                                      24456756
                                                      24456756
                                                      prgmCDGF8
                                                      24456756
                                                      201600
                                                      0
                                                      11112
                                                      11112
                                                      prgmCDGF8
                                                      11112
                                                      2


                                                      Explanation:



                                                      While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans  ;full program

                                                      While Ans>9 End ;loop until the product is one digit
                                                      Disp Ans ;print the current number
                                                      prod( ;get the product of
                                                      seq( ;the list generated by
                                                      10^(-X-1), ;consecutive powers of ten
                                                      X, ;using X as the increment variable
                                                      0, ;starting at 0
                                                      log(Ans ;ending at the length of the current number
                                                      ;(implicit increment by 1)
                                                      Ans ;multiplied by the current number
                                                      fPart( ;then taking the fractional part of each element
                                                      10 ;multiplied by 10
                                                      int( ;then truncating each element
                                                      Ans ;output last step since it was skipped




                                                      Notes:



                                                      TI-BASIC is a tokenized language. Character count does not equal byte count.



                                                      10^( is this one-byte token.



                                                      This program will not provide the correct sequence of products with integers greater than 14 digits long due to the limitations of decimal precision on the TI calculators.






                                                      share|improve this answer











                                                      $endgroup$



                                                      TI-BASIC (TI-84), 30 32 bytes



                                                      While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans


                                                      Input is in Ans.

                                                      Output is displayed as the challenge requests. The trailing Ans is needed to print the last step.



                                                      I will admit, I did not think of this formula myself, rather I found it here and modified it to better fit the challenge.



                                                      EDIT: Upon rereading the challenge, I realized that the program must terminate if the product is one digit. Hence, 2 bytes were to be added to account for this.



                                                      Example:



                                                      24456756
                                                      24456756
                                                      prgmCDGF8
                                                      24456756
                                                      201600
                                                      0
                                                      11112
                                                      11112
                                                      prgmCDGF8
                                                      11112
                                                      2


                                                      Explanation:



                                                      While Ans>9:Disp Ans:prod(int(10fPart(Ansseq(10^(-X-1),X,0,log(Ans:End:Ans  ;full program

                                                      While Ans>9 End ;loop until the product is one digit
                                                      Disp Ans ;print the current number
                                                      prod( ;get the product of
                                                      seq( ;the list generated by
                                                      10^(-X-1), ;consecutive powers of ten
                                                      X, ;using X as the increment variable
                                                      0, ;starting at 0
                                                      log(Ans ;ending at the length of the current number
                                                      ;(implicit increment by 1)
                                                      Ans ;multiplied by the current number
                                                      fPart( ;then taking the fractional part of each element
                                                      10 ;multiplied by 10
                                                      int( ;then truncating each element
                                                      Ans ;output last step since it was skipped




                                                      Notes:



                                                      TI-BASIC is a tokenized language. Character count does not equal byte count.



                                                      10^( is this one-byte token.



                                                      This program will not provide the correct sequence of products with integers greater than 14 digits long due to the limitations of decimal precision on the TI calculators.







                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited 5 hours ago

























                                                      answered yesterday









                                                      TauTau

                                                      586210




                                                      586210























                                                          8












                                                          $begingroup$


                                                          dzaima/APL, 14 11 bytes



                                                          ∪{×/⍎¨⍕⍵}⍡≡


                                                          Try it online!






                                                          share|improve this answer











                                                          $endgroup$













                                                          • $begingroup$
                                                            is really needed?
                                                            $endgroup$
                                                            – ngn
                                                            yesterday






                                                          • 2




                                                            $begingroup$
                                                            @ngn yep. Without it, there are two equal answers at the end, and it's been stated in the comments that a single digit must return a single digit
                                                            $endgroup$
                                                            – dzaima
                                                            yesterday










                                                          • $begingroup$
                                                            understood­­­­­
                                                            $endgroup$
                                                            – ngn
                                                            yesterday
















                                                          8












                                                          $begingroup$


                                                          dzaima/APL, 14 11 bytes



                                                          ∪{×/⍎¨⍕⍵}⍡≡


                                                          Try it online!






                                                          share|improve this answer











                                                          $endgroup$













                                                          • $begingroup$
                                                            is really needed?
                                                            $endgroup$
                                                            – ngn
                                                            yesterday






                                                          • 2




                                                            $begingroup$
                                                            @ngn yep. Without it, there are two equal answers at the end, and it's been stated in the comments that a single digit must return a single digit
                                                            $endgroup$
                                                            – dzaima
                                                            yesterday










                                                          • $begingroup$
                                                            understood­­­­­
                                                            $endgroup$
                                                            – ngn
                                                            yesterday














                                                          8












                                                          8








                                                          8





                                                          $begingroup$


                                                          dzaima/APL, 14 11 bytes



                                                          ∪{×/⍎¨⍕⍵}⍡≡


                                                          Try it online!






                                                          share|improve this answer











                                                          $endgroup$




                                                          dzaima/APL, 14 11 bytes



                                                          ∪{×/⍎¨⍕⍵}⍡≡


                                                          Try it online!







                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited yesterday

























                                                          answered yesterday









                                                          dzaimadzaima

                                                          15.8k22059




                                                          15.8k22059












                                                          • $begingroup$
                                                            is really needed?
                                                            $endgroup$
                                                            – ngn
                                                            yesterday






                                                          • 2




                                                            $begingroup$
                                                            @ngn yep. Without it, there are two equal answers at the end, and it's been stated in the comments that a single digit must return a single digit
                                                            $endgroup$
                                                            – dzaima
                                                            yesterday










                                                          • $begingroup$
                                                            understood­­­­­
                                                            $endgroup$
                                                            – ngn
                                                            yesterday


















                                                          • $begingroup$
                                                            is really needed?
                                                            $endgroup$
                                                            – ngn
                                                            yesterday






                                                          • 2




                                                            $begingroup$
                                                            @ngn yep. Without it, there are two equal answers at the end, and it's been stated in the comments that a single digit must return a single digit
                                                            $endgroup$
                                                            – dzaima
                                                            yesterday










                                                          • $begingroup$
                                                            understood­­­­­
                                                            $endgroup$
                                                            – ngn
                                                            yesterday
















                                                          $begingroup$
                                                          is really needed?
                                                          $endgroup$
                                                          – ngn
                                                          yesterday




                                                          $begingroup$
                                                          is really needed?
                                                          $endgroup$
                                                          – ngn
                                                          yesterday




                                                          2




                                                          2




                                                          $begingroup$
                                                          @ngn yep. Without it, there are two equal answers at the end, and it's been stated in the comments that a single digit must return a single digit
                                                          $endgroup$
                                                          – dzaima
                                                          yesterday




                                                          $begingroup$
                                                          @ngn yep. Without it, there are two equal answers at the end, and it's been stated in the comments that a single digit must return a single digit
                                                          $endgroup$
                                                          – dzaima
                                                          yesterday












                                                          $begingroup$
                                                          understood­­­­­
                                                          $endgroup$
                                                          – ngn
                                                          yesterday




                                                          $begingroup$
                                                          understood­­­­­
                                                          $endgroup$
                                                          – ngn
                                                          yesterday











                                                          8












                                                          $begingroup$


                                                          R, 59 bytes





                                                          n=scan();while(print(n)>9)n=prod(n%/%10^(nchar(n):1-1)%%10)


                                                          Try it online!



                                                          Since print invisibly returns its input, we can use print(n) inside the while loop to simulate a do-while loop. This is inspired by one of my tips for golfing in R.



                                                          The header helps prevent large numbers from being printed in scientific notation.






                                                          share|improve this answer











                                                          $endgroup$


















                                                            8












                                                            $begingroup$


                                                            R, 59 bytes





                                                            n=scan();while(print(n)>9)n=prod(n%/%10^(nchar(n):1-1)%%10)


                                                            Try it online!



                                                            Since print invisibly returns its input, we can use print(n) inside the while loop to simulate a do-while loop. This is inspired by one of my tips for golfing in R.



                                                            The header helps prevent large numbers from being printed in scientific notation.






                                                            share|improve this answer











                                                            $endgroup$
















                                                              8












                                                              8








                                                              8





                                                              $begingroup$


                                                              R, 59 bytes





                                                              n=scan();while(print(n)>9)n=prod(n%/%10^(nchar(n):1-1)%%10)


                                                              Try it online!



                                                              Since print invisibly returns its input, we can use print(n) inside the while loop to simulate a do-while loop. This is inspired by one of my tips for golfing in R.



                                                              The header helps prevent large numbers from being printed in scientific notation.






                                                              share|improve this answer











                                                              $endgroup$




                                                              R, 59 bytes





                                                              n=scan();while(print(n)>9)n=prod(n%/%10^(nchar(n):1-1)%%10)


                                                              Try it online!



                                                              Since print invisibly returns its input, we can use print(n) inside the while loop to simulate a do-while loop. This is inspired by one of my tips for golfing in R.



                                                              The header helps prevent large numbers from being printed in scientific notation.







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited yesterday

























                                                              answered yesterday









                                                              GiuseppeGiuseppe

                                                              17k31052




                                                              17k31052























                                                                  7












                                                                  $begingroup$


                                                                  05AB1E, 7 4 bytes



                                                                  Δ=SP


                                                                  Try it online or verify all test cases.



                                                                  Explanation:





                                                                  Δ     # Loop until the number no longer changes:
                                                                  = # Print the number with trailing newline (without popping the number itself)
                                                                  # (which will be the implicit input in the first iteration)
                                                                  SP # Convert the number to a list of digits, and calculate its product





                                                                  share|improve this answer











                                                                  $endgroup$


















                                                                    7












                                                                    $begingroup$


                                                                    05AB1E, 7 4 bytes



                                                                    Δ=SP


                                                                    Try it online or verify all test cases.



                                                                    Explanation:





                                                                    Δ     # Loop until the number no longer changes:
                                                                    = # Print the number with trailing newline (without popping the number itself)
                                                                    # (which will be the implicit input in the first iteration)
                                                                    SP # Convert the number to a list of digits, and calculate its product





                                                                    share|improve this answer











                                                                    $endgroup$
















                                                                      7












                                                                      7








                                                                      7





                                                                      $begingroup$


                                                                      05AB1E, 7 4 bytes



                                                                      Δ=SP


                                                                      Try it online or verify all test cases.



                                                                      Explanation:





                                                                      Δ     # Loop until the number no longer changes:
                                                                      = # Print the number with trailing newline (without popping the number itself)
                                                                      # (which will be the implicit input in the first iteration)
                                                                      SP # Convert the number to a list of digits, and calculate its product





                                                                      share|improve this answer











                                                                      $endgroup$




                                                                      05AB1E, 7 4 bytes



                                                                      Δ=SP


                                                                      Try it online or verify all test cases.



                                                                      Explanation:





                                                                      Δ     # Loop until the number no longer changes:
                                                                      = # Print the number with trailing newline (without popping the number itself)
                                                                      # (which will be the implicit input in the first iteration)
                                                                      SP # Convert the number to a list of digits, and calculate its product






                                                                      share|improve this answer














                                                                      share|improve this answer



                                                                      share|improve this answer








                                                                      edited 19 hours ago

























                                                                      answered yesterday









                                                                      Kevin CruijssenKevin Cruijssen

                                                                      41.3k567212




                                                                      41.3k567212























                                                                          6












                                                                          $begingroup$


                                                                          Wolfram Language (Mathematica), 47 bytes



                                                                          Most@FixedPointList[Times@@IntegerDigits@#&,#]&


                                                                          Try it online!






                                                                          share|improve this answer









                                                                          $endgroup$


















                                                                            6












                                                                            $begingroup$


                                                                            Wolfram Language (Mathematica), 47 bytes



                                                                            Most@FixedPointList[Times@@IntegerDigits@#&,#]&


                                                                            Try it online!






                                                                            share|improve this answer









                                                                            $endgroup$
















                                                                              6












                                                                              6








                                                                              6





                                                                              $begingroup$


                                                                              Wolfram Language (Mathematica), 47 bytes



                                                                              Most@FixedPointList[Times@@IntegerDigits@#&,#]&


                                                                              Try it online!






                                                                              share|improve this answer









                                                                              $endgroup$




                                                                              Wolfram Language (Mathematica), 47 bytes



                                                                              Most@FixedPointList[Times@@IntegerDigits@#&,#]&


                                                                              Try it online!







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered yesterday









                                                                              J42161217J42161217

                                                                              13.4k21251




                                                                              13.4k21251























                                                                                  6












                                                                                  $begingroup$


                                                                                  Perl 6, 23 bytes





                                                                                  {$_,{[*] .comb}…10>*}


                                                                                  Try it online!






                                                                                  share|improve this answer









                                                                                  $endgroup$


















                                                                                    6












                                                                                    $begingroup$


                                                                                    Perl 6, 23 bytes





                                                                                    {$_,{[*] .comb}…10>*}


                                                                                    Try it online!






                                                                                    share|improve this answer









                                                                                    $endgroup$
















                                                                                      6












                                                                                      6








                                                                                      6





                                                                                      $begingroup$


                                                                                      Perl 6, 23 bytes





                                                                                      {$_,{[*] .comb}…10>*}


                                                                                      Try it online!






                                                                                      share|improve this answer









                                                                                      $endgroup$




                                                                                      Perl 6, 23 bytes





                                                                                      {$_,{[*] .comb}…10>*}


                                                                                      Try it online!







                                                                                      share|improve this answer












                                                                                      share|improve this answer



                                                                                      share|improve this answer










                                                                                      answered yesterday









                                                                                      GrimyGrimy

                                                                                      2,5611019




                                                                                      2,5611019























                                                                                          6












                                                                                          $begingroup$


                                                                                          Python 2,  46  43 bytes





                                                                                          -3 thanks to xnor (chained comparison)



                                                                                          def f(n):print n;n>9>f(eval('*'.join(`n`)))


                                                                                          Try it online!






                                                                                          share|improve this answer











                                                                                          $endgroup$













                                                                                          • $begingroup$
                                                                                            You can do > in place of and.
                                                                                            $endgroup$
                                                                                            – xnor
                                                                                            yesterday










                                                                                          • $begingroup$
                                                                                            @xnor thanks, easy to forget that will work.
                                                                                            $endgroup$
                                                                                            – Jonathan Allan
                                                                                            22 hours ago
















                                                                                          6












                                                                                          $begingroup$


                                                                                          Python 2,  46  43 bytes





                                                                                          -3 thanks to xnor (chained comparison)



                                                                                          def f(n):print n;n>9>f(eval('*'.join(`n`)))


                                                                                          Try it online!






                                                                                          share|improve this answer











                                                                                          $endgroup$













                                                                                          • $begingroup$
                                                                                            You can do > in place of and.
                                                                                            $endgroup$
                                                                                            – xnor
                                                                                            yesterday










                                                                                          • $begingroup$
                                                                                            @xnor thanks, easy to forget that will work.
                                                                                            $endgroup$
                                                                                            – Jonathan Allan
                                                                                            22 hours ago














                                                                                          6












                                                                                          6








                                                                                          6





                                                                                          $begingroup$


                                                                                          Python 2,  46  43 bytes





                                                                                          -3 thanks to xnor (chained comparison)



                                                                                          def f(n):print n;n>9>f(eval('*'.join(`n`)))


                                                                                          Try it online!






                                                                                          share|improve this answer











                                                                                          $endgroup$




                                                                                          Python 2,  46  43 bytes





                                                                                          -3 thanks to xnor (chained comparison)



                                                                                          def f(n):print n;n>9>f(eval('*'.join(`n`)))


                                                                                          Try it online!







                                                                                          share|improve this answer














                                                                                          share|improve this answer



                                                                                          share|improve this answer








                                                                                          edited 21 hours ago

























                                                                                          answered yesterday









                                                                                          Jonathan AllanJonathan Allan

                                                                                          53.4k535172




                                                                                          53.4k535172












                                                                                          • $begingroup$
                                                                                            You can do > in place of and.
                                                                                            $endgroup$
                                                                                            – xnor
                                                                                            yesterday










                                                                                          • $begingroup$
                                                                                            @xnor thanks, easy to forget that will work.
                                                                                            $endgroup$
                                                                                            – Jonathan Allan
                                                                                            22 hours ago


















                                                                                          • $begingroup$
                                                                                            You can do > in place of and.
                                                                                            $endgroup$
                                                                                            – xnor
                                                                                            yesterday










                                                                                          • $begingroup$
                                                                                            @xnor thanks, easy to forget that will work.
                                                                                            $endgroup$
                                                                                            – Jonathan Allan
                                                                                            22 hours ago
















                                                                                          $begingroup$
                                                                                          You can do > in place of and.
                                                                                          $endgroup$
                                                                                          – xnor
                                                                                          yesterday




                                                                                          $begingroup$
                                                                                          You can do > in place of and.
                                                                                          $endgroup$
                                                                                          – xnor
                                                                                          yesterday












                                                                                          $begingroup$
                                                                                          @xnor thanks, easy to forget that will work.
                                                                                          $endgroup$
                                                                                          – Jonathan Allan
                                                                                          22 hours ago




                                                                                          $begingroup$
                                                                                          @xnor thanks, easy to forget that will work.
                                                                                          $endgroup$
                                                                                          – Jonathan Allan
                                                                                          22 hours ago











                                                                                          5












                                                                                          $begingroup$


                                                                                          Julia 0.7, 36 bytes





                                                                                          f(n)=n>9?[n,f(prod(digits(n)))...]:n


                                                                                          Try it online!






                                                                                          share|improve this answer









                                                                                          $endgroup$


















                                                                                            5












                                                                                            $begingroup$


                                                                                            Julia 0.7, 36 bytes





                                                                                            f(n)=n>9?[n,f(prod(digits(n)))...]:n


                                                                                            Try it online!






                                                                                            share|improve this answer









                                                                                            $endgroup$
















                                                                                              5












                                                                                              5








                                                                                              5





                                                                                              $begingroup$


                                                                                              Julia 0.7, 36 bytes





                                                                                              f(n)=n>9?[n,f(prod(digits(n)))...]:n


                                                                                              Try it online!






                                                                                              share|improve this answer









                                                                                              $endgroup$




                                                                                              Julia 0.7, 36 bytes





                                                                                              f(n)=n>9?[n,f(prod(digits(n)))...]:n


                                                                                              Try it online!







                                                                                              share|improve this answer












                                                                                              share|improve this answer



                                                                                              share|improve this answer










                                                                                              answered yesterday









                                                                                              Kirill L.Kirill L.

                                                                                              5,6831525




                                                                                              5,6831525























                                                                                                  5












                                                                                                  $begingroup$


                                                                                                  PowerShell, 54 bytes





                                                                                                  for($a=$args;$a-gt9){$a;$a=("$a"|% t*y)-join"*"|iex}$a


                                                                                                  Try it online!





                                                                                                  Iterative method that first writes the input argument, then converts it into a string and pipes it into a character array. This array is joined by a single asterisks, and executed as a command with the invoke expression alias. Since this writes Starting number down to the last number greater than 0, (20, in the given test scenario), I add a final $a to the end to output.






                                                                                                  share|improve this answer











                                                                                                  $endgroup$


















                                                                                                    5












                                                                                                    $begingroup$


                                                                                                    PowerShell, 54 bytes





                                                                                                    for($a=$args;$a-gt9){$a;$a=("$a"|% t*y)-join"*"|iex}$a


                                                                                                    Try it online!





                                                                                                    Iterative method that first writes the input argument, then converts it into a string and pipes it into a character array. This array is joined by a single asterisks, and executed as a command with the invoke expression alias. Since this writes Starting number down to the last number greater than 0, (20, in the given test scenario), I add a final $a to the end to output.






                                                                                                    share|improve this answer











                                                                                                    $endgroup$
















                                                                                                      5












                                                                                                      5








                                                                                                      5





                                                                                                      $begingroup$


                                                                                                      PowerShell, 54 bytes





                                                                                                      for($a=$args;$a-gt9){$a;$a=("$a"|% t*y)-join"*"|iex}$a


                                                                                                      Try it online!





                                                                                                      Iterative method that first writes the input argument, then converts it into a string and pipes it into a character array. This array is joined by a single asterisks, and executed as a command with the invoke expression alias. Since this writes Starting number down to the last number greater than 0, (20, in the given test scenario), I add a final $a to the end to output.






                                                                                                      share|improve this answer











                                                                                                      $endgroup$




                                                                                                      PowerShell, 54 bytes





                                                                                                      for($a=$args;$a-gt9){$a;$a=("$a"|% t*y)-join"*"|iex}$a


                                                                                                      Try it online!





                                                                                                      Iterative method that first writes the input argument, then converts it into a string and pipes it into a character array. This array is joined by a single asterisks, and executed as a command with the invoke expression alias. Since this writes Starting number down to the last number greater than 0, (20, in the given test scenario), I add a final $a to the end to output.







                                                                                                      share|improve this answer














                                                                                                      share|improve this answer



                                                                                                      share|improve this answer








                                                                                                      edited yesterday

























                                                                                                      answered yesterday









                                                                                                      KGlasierKGlasier

                                                                                                      1916




                                                                                                      1916























                                                                                                          5












                                                                                                          $begingroup$


                                                                                                          Python 2, 61 62 59 bytes





                                                                                                          def f(n):print n;n>9and f(reduce(int.__mul__,map(int,`n`)))


                                                                                                          Try it online!



                                                                                                          -3 bytes, thanks to Jonathan Allan






                                                                                                          share|improve this answer











                                                                                                          $endgroup$













                                                                                                          • $begingroup$
                                                                                                            Doesn't work for inputs that don't end with a 0 on their last iteration, for example 23
                                                                                                            $endgroup$
                                                                                                            – Embodiment of Ignorance
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            @EmbodimentofIgnorance Fixed :)
                                                                                                            $endgroup$
                                                                                                            – TFeld
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            int.__mul__ is three bytes less than lambda a,b:a*b
                                                                                                            $endgroup$
                                                                                                            – Jonathan Allan
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            @JonathanAllan Thanks! I knew there had to be something like that
                                                                                                            $endgroup$
                                                                                                            – TFeld
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            Change f(reduce(int.__mul__,map(int,`n`))) to f(eval('*'.join(`n`))) to save 13 bytes.
                                                                                                            $endgroup$
                                                                                                            – mypetlion
                                                                                                            yesterday


















                                                                                                          5












                                                                                                          $begingroup$


                                                                                                          Python 2, 61 62 59 bytes





                                                                                                          def f(n):print n;n>9and f(reduce(int.__mul__,map(int,`n`)))


                                                                                                          Try it online!



                                                                                                          -3 bytes, thanks to Jonathan Allan






                                                                                                          share|improve this answer











                                                                                                          $endgroup$













                                                                                                          • $begingroup$
                                                                                                            Doesn't work for inputs that don't end with a 0 on their last iteration, for example 23
                                                                                                            $endgroup$
                                                                                                            – Embodiment of Ignorance
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            @EmbodimentofIgnorance Fixed :)
                                                                                                            $endgroup$
                                                                                                            – TFeld
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            int.__mul__ is three bytes less than lambda a,b:a*b
                                                                                                            $endgroup$
                                                                                                            – Jonathan Allan
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            @JonathanAllan Thanks! I knew there had to be something like that
                                                                                                            $endgroup$
                                                                                                            – TFeld
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            Change f(reduce(int.__mul__,map(int,`n`))) to f(eval('*'.join(`n`))) to save 13 bytes.
                                                                                                            $endgroup$
                                                                                                            – mypetlion
                                                                                                            yesterday
















                                                                                                          5












                                                                                                          5








                                                                                                          5





                                                                                                          $begingroup$


                                                                                                          Python 2, 61 62 59 bytes





                                                                                                          def f(n):print n;n>9and f(reduce(int.__mul__,map(int,`n`)))


                                                                                                          Try it online!



                                                                                                          -3 bytes, thanks to Jonathan Allan






                                                                                                          share|improve this answer











                                                                                                          $endgroup$




                                                                                                          Python 2, 61 62 59 bytes





                                                                                                          def f(n):print n;n>9and f(reduce(int.__mul__,map(int,`n`)))


                                                                                                          Try it online!



                                                                                                          -3 bytes, thanks to Jonathan Allan







                                                                                                          share|improve this answer














                                                                                                          share|improve this answer



                                                                                                          share|improve this answer








                                                                                                          edited yesterday

























                                                                                                          answered yesterday









                                                                                                          TFeldTFeld

                                                                                                          15.9k21449




                                                                                                          15.9k21449












                                                                                                          • $begingroup$
                                                                                                            Doesn't work for inputs that don't end with a 0 on their last iteration, for example 23
                                                                                                            $endgroup$
                                                                                                            – Embodiment of Ignorance
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            @EmbodimentofIgnorance Fixed :)
                                                                                                            $endgroup$
                                                                                                            – TFeld
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            int.__mul__ is three bytes less than lambda a,b:a*b
                                                                                                            $endgroup$
                                                                                                            – Jonathan Allan
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            @JonathanAllan Thanks! I knew there had to be something like that
                                                                                                            $endgroup$
                                                                                                            – TFeld
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            Change f(reduce(int.__mul__,map(int,`n`))) to f(eval('*'.join(`n`))) to save 13 bytes.
                                                                                                            $endgroup$
                                                                                                            – mypetlion
                                                                                                            yesterday




















                                                                                                          • $begingroup$
                                                                                                            Doesn't work for inputs that don't end with a 0 on their last iteration, for example 23
                                                                                                            $endgroup$
                                                                                                            – Embodiment of Ignorance
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            @EmbodimentofIgnorance Fixed :)
                                                                                                            $endgroup$
                                                                                                            – TFeld
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            int.__mul__ is three bytes less than lambda a,b:a*b
                                                                                                            $endgroup$
                                                                                                            – Jonathan Allan
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            @JonathanAllan Thanks! I knew there had to be something like that
                                                                                                            $endgroup$
                                                                                                            – TFeld
                                                                                                            yesterday










                                                                                                          • $begingroup$
                                                                                                            Change f(reduce(int.__mul__,map(int,`n`))) to f(eval('*'.join(`n`))) to save 13 bytes.
                                                                                                            $endgroup$
                                                                                                            – mypetlion
                                                                                                            yesterday


















                                                                                                          $begingroup$
                                                                                                          Doesn't work for inputs that don't end with a 0 on their last iteration, for example 23
                                                                                                          $endgroup$
                                                                                                          – Embodiment of Ignorance
                                                                                                          yesterday




                                                                                                          $begingroup$
                                                                                                          Doesn't work for inputs that don't end with a 0 on their last iteration, for example 23
                                                                                                          $endgroup$
                                                                                                          – Embodiment of Ignorance
                                                                                                          yesterday












                                                                                                          $begingroup$
                                                                                                          @EmbodimentofIgnorance Fixed :)
                                                                                                          $endgroup$
                                                                                                          – TFeld
                                                                                                          yesterday




                                                                                                          $begingroup$
                                                                                                          @EmbodimentofIgnorance Fixed :)
                                                                                                          $endgroup$
                                                                                                          – TFeld
                                                                                                          yesterday












                                                                                                          $begingroup$
                                                                                                          int.__mul__ is three bytes less than lambda a,b:a*b
                                                                                                          $endgroup$
                                                                                                          – Jonathan Allan
                                                                                                          yesterday




                                                                                                          $begingroup$
                                                                                                          int.__mul__ is three bytes less than lambda a,b:a*b
                                                                                                          $endgroup$
                                                                                                          – Jonathan Allan
                                                                                                          yesterday












                                                                                                          $begingroup$
                                                                                                          @JonathanAllan Thanks! I knew there had to be something like that
                                                                                                          $endgroup$
                                                                                                          – TFeld
                                                                                                          yesterday




                                                                                                          $begingroup$
                                                                                                          @JonathanAllan Thanks! I knew there had to be something like that
                                                                                                          $endgroup$
                                                                                                          – TFeld
                                                                                                          yesterday












                                                                                                          $begingroup$
                                                                                                          Change f(reduce(int.__mul__,map(int,`n`))) to f(eval('*'.join(`n`))) to save 13 bytes.
                                                                                                          $endgroup$
                                                                                                          – mypetlion
                                                                                                          yesterday






                                                                                                          $begingroup$
                                                                                                          Change f(reduce(int.__mul__,map(int,`n`))) to f(eval('*'.join(`n`))) to save 13 bytes.
                                                                                                          $endgroup$
                                                                                                          – mypetlion
                                                                                                          yesterday













                                                                                                          5












                                                                                                          $begingroup$


                                                                                                          Jelly, 4 bytes



                                                                                                          DP$Ƭ


                                                                                                          Try it online!



                                                                                                          Explanation



                                                                                                          D    | convert to decimal digits
                                                                                                          P | take the product
                                                                                                          $ | previous two links as a monad
                                                                                                          Ƭ | loop until no change, collecting all intermediate results


                                                                                                          As a bonus, here's a TIO which will find the numbers with the largest number of steps for a given range of numbers of digits. It scales well even on TIO.






                                                                                                          share|improve this answer











                                                                                                          $endgroup$


















                                                                                                            5












                                                                                                            $begingroup$


                                                                                                            Jelly, 4 bytes



                                                                                                            DP$Ƭ


                                                                                                            Try it online!



                                                                                                            Explanation



                                                                                                            D    | convert to decimal digits
                                                                                                            P | take the product
                                                                                                            $ | previous two links as a monad
                                                                                                            Ƭ | loop until no change, collecting all intermediate results


                                                                                                            As a bonus, here's a TIO which will find the numbers with the largest number of steps for a given range of numbers of digits. It scales well even on TIO.






                                                                                                            share|improve this answer











                                                                                                            $endgroup$
















                                                                                                              5












                                                                                                              5








                                                                                                              5





                                                                                                              $begingroup$


                                                                                                              Jelly, 4 bytes



                                                                                                              DP$Ƭ


                                                                                                              Try it online!



                                                                                                              Explanation



                                                                                                              D    | convert to decimal digits
                                                                                                              P | take the product
                                                                                                              $ | previous two links as a monad
                                                                                                              Ƭ | loop until no change, collecting all intermediate results


                                                                                                              As a bonus, here's a TIO which will find the numbers with the largest number of steps for a given range of numbers of digits. It scales well even on TIO.






                                                                                                              share|improve this answer











                                                                                                              $endgroup$




                                                                                                              Jelly, 4 bytes



                                                                                                              DP$Ƭ


                                                                                                              Try it online!



                                                                                                              Explanation



                                                                                                              D    | convert to decimal digits
                                                                                                              P | take the product
                                                                                                              $ | previous two links as a monad
                                                                                                              Ƭ | loop until no change, collecting all intermediate results


                                                                                                              As a bonus, here's a TIO which will find the numbers with the largest number of steps for a given range of numbers of digits. It scales well even on TIO.







                                                                                                              share|improve this answer














                                                                                                              share|improve this answer



                                                                                                              share|improve this answer








                                                                                                              edited yesterday

























                                                                                                              answered yesterday









                                                                                                              Nick KennedyNick Kennedy

                                                                                                              89137




                                                                                                              89137























                                                                                                                  5












                                                                                                                  $begingroup$

                                                                                                                  perl 5 (-n -M5.01), 32 30 25 bytes



                                                                                                                  say$_=eval;s/B/*/g&&redo


                                                                                                                  25 bytes



                                                                                                                  30 bytes



                                                                                                                  32 bytes






                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$













                                                                                                                  • $begingroup$
                                                                                                                    You should mention that this uses -lpF//
                                                                                                                    $endgroup$
                                                                                                                    – Grimy
                                                                                                                    21 hours ago










                                                                                                                  • $begingroup$
                                                                                                                    @Grimy i could save 2 bytes without using -lpF//, updating
                                                                                                                    $endgroup$
                                                                                                                    – Nahuel Fouilleul
                                                                                                                    21 hours ago
















                                                                                                                  5












                                                                                                                  $begingroup$

                                                                                                                  perl 5 (-n -M5.01), 32 30 25 bytes



                                                                                                                  say$_=eval;s/B/*/g&&redo


                                                                                                                  25 bytes



                                                                                                                  30 bytes



                                                                                                                  32 bytes






                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$













                                                                                                                  • $begingroup$
                                                                                                                    You should mention that this uses -lpF//
                                                                                                                    $endgroup$
                                                                                                                    – Grimy
                                                                                                                    21 hours ago










                                                                                                                  • $begingroup$
                                                                                                                    @Grimy i could save 2 bytes without using -lpF//, updating
                                                                                                                    $endgroup$
                                                                                                                    – Nahuel Fouilleul
                                                                                                                    21 hours ago














                                                                                                                  5












                                                                                                                  5








                                                                                                                  5





                                                                                                                  $begingroup$

                                                                                                                  perl 5 (-n -M5.01), 32 30 25 bytes



                                                                                                                  say$_=eval;s/B/*/g&&redo


                                                                                                                  25 bytes



                                                                                                                  30 bytes



                                                                                                                  32 bytes






                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$



                                                                                                                  perl 5 (-n -M5.01), 32 30 25 bytes



                                                                                                                  say$_=eval;s/B/*/g&&redo


                                                                                                                  25 bytes



                                                                                                                  30 bytes



                                                                                                                  32 bytes







                                                                                                                  share|improve this answer














                                                                                                                  share|improve this answer



                                                                                                                  share|improve this answer








                                                                                                                  edited 21 hours ago

























                                                                                                                  answered yesterday









                                                                                                                  Nahuel FouilleulNahuel Fouilleul

                                                                                                                  2,905211




                                                                                                                  2,905211












                                                                                                                  • $begingroup$
                                                                                                                    You should mention that this uses -lpF//
                                                                                                                    $endgroup$
                                                                                                                    – Grimy
                                                                                                                    21 hours ago










                                                                                                                  • $begingroup$
                                                                                                                    @Grimy i could save 2 bytes without using -lpF//, updating
                                                                                                                    $endgroup$
                                                                                                                    – Nahuel Fouilleul
                                                                                                                    21 hours ago


















                                                                                                                  • $begingroup$
                                                                                                                    You should mention that this uses -lpF//
                                                                                                                    $endgroup$
                                                                                                                    – Grimy
                                                                                                                    21 hours ago










                                                                                                                  • $begingroup$
                                                                                                                    @Grimy i could save 2 bytes without using -lpF//, updating
                                                                                                                    $endgroup$
                                                                                                                    – Nahuel Fouilleul
                                                                                                                    21 hours ago
















                                                                                                                  $begingroup$
                                                                                                                  You should mention that this uses -lpF//
                                                                                                                  $endgroup$
                                                                                                                  – Grimy
                                                                                                                  21 hours ago




                                                                                                                  $begingroup$
                                                                                                                  You should mention that this uses -lpF//
                                                                                                                  $endgroup$
                                                                                                                  – Grimy
                                                                                                                  21 hours ago












                                                                                                                  $begingroup$
                                                                                                                  @Grimy i could save 2 bytes without using -lpF//, updating
                                                                                                                  $endgroup$
                                                                                                                  – Nahuel Fouilleul
                                                                                                                  21 hours ago




                                                                                                                  $begingroup$
                                                                                                                  @Grimy i could save 2 bytes without using -lpF//, updating
                                                                                                                  $endgroup$
                                                                                                                  – Nahuel Fouilleul
                                                                                                                  21 hours ago











                                                                                                                  5












                                                                                                                  $begingroup$


                                                                                                                  MathGolf, 9 10 bytes



                                                                                                                  h(ôo▒ε*h(→


                                                                                                                  Try it online!



                                                                                                                  Now it correctly handles inputs that are single digits. Not perfect, but at least it is correct.



                                                                                                                  Explanation



                                                                                                                  h(            check length of input number and decrease by 1
                                                                                                                  ö → while true with pop using the next 6 operators
                                                                                                                  p print with newline
                                                                                                                  ▒ split to list of chars/digits
                                                                                                                  ε* reduce list by multiplication
                                                                                                                  h( length of TOS without popping, subtracted by 1 (exits when len(TOS) == 1)





                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$













                                                                                                                  • $begingroup$
                                                                                                                    The output for a single digit input should be one copy of the number - clarified in the comments
                                                                                                                    $endgroup$
                                                                                                                    – dzaima
                                                                                                                    yesterday










                                                                                                                  • $begingroup$
                                                                                                                    @dzaima I'll look into it, and update the answer when it's solved
                                                                                                                    $endgroup$
                                                                                                                    – maxb
                                                                                                                    22 hours ago
















                                                                                                                  5












                                                                                                                  $begingroup$


                                                                                                                  MathGolf, 9 10 bytes



                                                                                                                  h(ôo▒ε*h(→


                                                                                                                  Try it online!



                                                                                                                  Now it correctly handles inputs that are single digits. Not perfect, but at least it is correct.



                                                                                                                  Explanation



                                                                                                                  h(            check length of input number and decrease by 1
                                                                                                                  ö → while true with pop using the next 6 operators
                                                                                                                  p print with newline
                                                                                                                  ▒ split to list of chars/digits
                                                                                                                  ε* reduce list by multiplication
                                                                                                                  h( length of TOS without popping, subtracted by 1 (exits when len(TOS) == 1)





                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$













                                                                                                                  • $begingroup$
                                                                                                                    The output for a single digit input should be one copy of the number - clarified in the comments
                                                                                                                    $endgroup$
                                                                                                                    – dzaima
                                                                                                                    yesterday










                                                                                                                  • $begingroup$
                                                                                                                    @dzaima I'll look into it, and update the answer when it's solved
                                                                                                                    $endgroup$
                                                                                                                    – maxb
                                                                                                                    22 hours ago














                                                                                                                  5












                                                                                                                  5








                                                                                                                  5





                                                                                                                  $begingroup$


                                                                                                                  MathGolf, 9 10 bytes



                                                                                                                  h(ôo▒ε*h(→


                                                                                                                  Try it online!



                                                                                                                  Now it correctly handles inputs that are single digits. Not perfect, but at least it is correct.



                                                                                                                  Explanation



                                                                                                                  h(            check length of input number and decrease by 1
                                                                                                                  ö → while true with pop using the next 6 operators
                                                                                                                  p print with newline
                                                                                                                  ▒ split to list of chars/digits
                                                                                                                  ε* reduce list by multiplication
                                                                                                                  h( length of TOS without popping, subtracted by 1 (exits when len(TOS) == 1)





                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$




                                                                                                                  MathGolf, 9 10 bytes



                                                                                                                  h(ôo▒ε*h(→


                                                                                                                  Try it online!



                                                                                                                  Now it correctly handles inputs that are single digits. Not perfect, but at least it is correct.



                                                                                                                  Explanation



                                                                                                                  h(            check length of input number and decrease by 1
                                                                                                                  ö → while true with pop using the next 6 operators
                                                                                                                  p print with newline
                                                                                                                  ▒ split to list of chars/digits
                                                                                                                  ε* reduce list by multiplication
                                                                                                                  h( length of TOS without popping, subtracted by 1 (exits when len(TOS) == 1)






                                                                                                                  share|improve this answer














                                                                                                                  share|improve this answer



                                                                                                                  share|improve this answer








                                                                                                                  edited 5 hours ago









                                                                                                                  Scott Milner

                                                                                                                  1,676521




                                                                                                                  1,676521










                                                                                                                  answered yesterday









                                                                                                                  maxbmaxb

                                                                                                                  3,30811232




                                                                                                                  3,30811232












                                                                                                                  • $begingroup$
                                                                                                                    The output for a single digit input should be one copy of the number - clarified in the comments
                                                                                                                    $endgroup$
                                                                                                                    – dzaima
                                                                                                                    yesterday










                                                                                                                  • $begingroup$
                                                                                                                    @dzaima I'll look into it, and update the answer when it's solved
                                                                                                                    $endgroup$
                                                                                                                    – maxb
                                                                                                                    22 hours ago


















                                                                                                                  • $begingroup$
                                                                                                                    The output for a single digit input should be one copy of the number - clarified in the comments
                                                                                                                    $endgroup$
                                                                                                                    – dzaima
                                                                                                                    yesterday










                                                                                                                  • $begingroup$
                                                                                                                    @dzaima I'll look into it, and update the answer when it's solved
                                                                                                                    $endgroup$
                                                                                                                    – maxb
                                                                                                                    22 hours ago
















                                                                                                                  $begingroup$
                                                                                                                  The output for a single digit input should be one copy of the number - clarified in the comments
                                                                                                                  $endgroup$
                                                                                                                  – dzaima
                                                                                                                  yesterday




                                                                                                                  $begingroup$
                                                                                                                  The output for a single digit input should be one copy of the number - clarified in the comments
                                                                                                                  $endgroup$
                                                                                                                  – dzaima
                                                                                                                  yesterday












                                                                                                                  $begingroup$
                                                                                                                  @dzaima I'll look into it, and update the answer when it's solved
                                                                                                                  $endgroup$
                                                                                                                  – maxb
                                                                                                                  22 hours ago




                                                                                                                  $begingroup$
                                                                                                                  @dzaima I'll look into it, and update the answer when it's solved
                                                                                                                  $endgroup$
                                                                                                                  – maxb
                                                                                                                  22 hours ago











                                                                                                                  4












                                                                                                                  $begingroup$

                                                                                                                  JavaScript (ES6), 45 bytes



                                                                                                                  Returns an array of integers.





                                                                                                                  f=n=>[n,...n>9?f(eval([...n+''].join`*`)):]


                                                                                                                  Try it online!






                                                                                                                  share|improve this answer











                                                                                                                  $endgroup$


















                                                                                                                    4












                                                                                                                    $begingroup$

                                                                                                                    JavaScript (ES6), 45 bytes



                                                                                                                    Returns an array of integers.





                                                                                                                    f=n=>[n,...n>9?f(eval([...n+''].join`*`)):]


                                                                                                                    Try it online!






                                                                                                                    share|improve this answer











                                                                                                                    $endgroup$
















                                                                                                                      4












                                                                                                                      4








                                                                                                                      4





                                                                                                                      $begingroup$

                                                                                                                      JavaScript (ES6), 45 bytes



                                                                                                                      Returns an array of integers.





                                                                                                                      f=n=>[n,...n>9?f(eval([...n+''].join`*`)):]


                                                                                                                      Try it online!






                                                                                                                      share|improve this answer











                                                                                                                      $endgroup$



                                                                                                                      JavaScript (ES6), 45 bytes



                                                                                                                      Returns an array of integers.





                                                                                                                      f=n=>[n,...n>9?f(eval([...n+''].join`*`)):]


                                                                                                                      Try it online!







                                                                                                                      share|improve this answer














                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer








                                                                                                                      edited yesterday

























                                                                                                                      answered yesterday









                                                                                                                      ArnauldArnauld

                                                                                                                      79.5k796330




                                                                                                                      79.5k796330























                                                                                                                          4












                                                                                                                          $begingroup$


                                                                                                                          Wolfram Language (Mathematica), 45 bytes



                                                                                                                          #//.x_/;x>9:>Times@@IntegerDigits@x&&Print@x&


                                                                                                                          Try it online!






                                                                                                                          share|improve this answer









                                                                                                                          $endgroup$


















                                                                                                                            4












                                                                                                                            $begingroup$


                                                                                                                            Wolfram Language (Mathematica), 45 bytes



                                                                                                                            #//.x_/;x>9:>Times@@IntegerDigits@x&&Print@x&


                                                                                                                            Try it online!






                                                                                                                            share|improve this answer









                                                                                                                            $endgroup$
















                                                                                                                              4












                                                                                                                              4








                                                                                                                              4





                                                                                                                              $begingroup$


                                                                                                                              Wolfram Language (Mathematica), 45 bytes



                                                                                                                              #//.x_/;x>9:>Times@@IntegerDigits@x&&Print@x&


                                                                                                                              Try it online!






                                                                                                                              share|improve this answer









                                                                                                                              $endgroup$




                                                                                                                              Wolfram Language (Mathematica), 45 bytes



                                                                                                                              #//.x_/;x>9:>Times@@IntegerDigits@x&&Print@x&


                                                                                                                              Try it online!







                                                                                                                              share|improve this answer












                                                                                                                              share|improve this answer



                                                                                                                              share|improve this answer










                                                                                                                              answered yesterday









                                                                                                                              J42161217J42161217

                                                                                                                              13.4k21251




                                                                                                                              13.4k21251























                                                                                                                                  4












                                                                                                                                  $begingroup$


                                                                                                                                  PowerShell, 51 bytes





                                                                                                                                  filter f{$_
                                                                                                                                  if($_-gt9){("$_"|% t*y)-join'*'|iex|f}}


                                                                                                                                  Try it online!






                                                                                                                                  share|improve this answer









                                                                                                                                  $endgroup$


















                                                                                                                                    4












                                                                                                                                    $begingroup$


                                                                                                                                    PowerShell, 51 bytes





                                                                                                                                    filter f{$_
                                                                                                                                    if($_-gt9){("$_"|% t*y)-join'*'|iex|f}}


                                                                                                                                    Try it online!






                                                                                                                                    share|improve this answer









                                                                                                                                    $endgroup$
















                                                                                                                                      4












                                                                                                                                      4








                                                                                                                                      4





                                                                                                                                      $begingroup$


                                                                                                                                      PowerShell, 51 bytes





                                                                                                                                      filter f{$_
                                                                                                                                      if($_-gt9){("$_"|% t*y)-join'*'|iex|f}}


                                                                                                                                      Try it online!






                                                                                                                                      share|improve this answer









                                                                                                                                      $endgroup$




                                                                                                                                      PowerShell, 51 bytes





                                                                                                                                      filter f{$_
                                                                                                                                      if($_-gt9){("$_"|% t*y)-join'*'|iex|f}}


                                                                                                                                      Try it online!







                                                                                                                                      share|improve this answer












                                                                                                                                      share|improve this answer



                                                                                                                                      share|improve this answer










                                                                                                                                      answered yesterday









                                                                                                                                      mazzymazzy

                                                                                                                                      2,8951317




                                                                                                                                      2,8951317























                                                                                                                                          4












                                                                                                                                          $begingroup$


                                                                                                                                          C# (Visual C# Interactive Compiler), 79 74 68 bytes





                                                                                                                                          void f(int a){Print(a);if(a>9)f((a+"").Aggregate(1,(j,k)=>k%48*j));}


                                                                                                                                          I try to stay away from recursion in C# due to how long the method declaration is, but in this case it saves compared to a loop.



                                                                                                                                          Try it online!






                                                                                                                                          share|improve this answer











                                                                                                                                          $endgroup$


















                                                                                                                                            4












                                                                                                                                            $begingroup$


                                                                                                                                            C# (Visual C# Interactive Compiler), 79 74 68 bytes





                                                                                                                                            void f(int a){Print(a);if(a>9)f((a+"").Aggregate(1,(j,k)=>k%48*j));}


                                                                                                                                            I try to stay away from recursion in C# due to how long the method declaration is, but in this case it saves compared to a loop.



                                                                                                                                            Try it online!






                                                                                                                                            share|improve this answer











                                                                                                                                            $endgroup$
















                                                                                                                                              4












                                                                                                                                              4








                                                                                                                                              4





                                                                                                                                              $begingroup$


                                                                                                                                              C# (Visual C# Interactive Compiler), 79 74 68 bytes





                                                                                                                                              void f(int a){Print(a);if(a>9)f((a+"").Aggregate(1,(j,k)=>k%48*j));}


                                                                                                                                              I try to stay away from recursion in C# due to how long the method declaration is, but in this case it saves compared to a loop.



                                                                                                                                              Try it online!






                                                                                                                                              share|improve this answer











                                                                                                                                              $endgroup$




                                                                                                                                              C# (Visual C# Interactive Compiler), 79 74 68 bytes





                                                                                                                                              void f(int a){Print(a);if(a>9)f((a+"").Aggregate(1,(j,k)=>k%48*j));}


                                                                                                                                              I try to stay away from recursion in C# due to how long the method declaration is, but in this case it saves compared to a loop.



                                                                                                                                              Try it online!







                                                                                                                                              share|improve this answer














                                                                                                                                              share|improve this answer



                                                                                                                                              share|improve this answer








                                                                                                                                              edited yesterday

























                                                                                                                                              answered yesterday









                                                                                                                                              Embodiment of IgnoranceEmbodiment of Ignorance

                                                                                                                                              2,128125




                                                                                                                                              2,128125























                                                                                                                                                  4












                                                                                                                                                  $begingroup$

                                                                                                                                                  Haskell, 45 bytes



                                                                                                                                                  f n=n:[x|n>9,x<-f$product$read.pure<$>show n]


                                                                                                                                                  Try it online!






                                                                                                                                                  share|improve this answer









                                                                                                                                                  $endgroup$


















                                                                                                                                                    4












                                                                                                                                                    $begingroup$

                                                                                                                                                    Haskell, 45 bytes



                                                                                                                                                    f n=n:[x|n>9,x<-f$product$read.pure<$>show n]


                                                                                                                                                    Try it online!






                                                                                                                                                    share|improve this answer









                                                                                                                                                    $endgroup$
















                                                                                                                                                      4












                                                                                                                                                      4








                                                                                                                                                      4





                                                                                                                                                      $begingroup$

                                                                                                                                                      Haskell, 45 bytes



                                                                                                                                                      f n=n:[x|n>9,x<-f$product$read.pure<$>show n]


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer









                                                                                                                                                      $endgroup$



                                                                                                                                                      Haskell, 45 bytes



                                                                                                                                                      f n=n:[x|n>9,x<-f$product$read.pure<$>show n]


                                                                                                                                                      Try it online!







                                                                                                                                                      share|improve this answer












                                                                                                                                                      share|improve this answer



                                                                                                                                                      share|improve this answer










                                                                                                                                                      answered yesterday









                                                                                                                                                      niminimi

                                                                                                                                                      32.4k32389




                                                                                                                                                      32.4k32389























                                                                                                                                                          4












                                                                                                                                                          $begingroup$


                                                                                                                                                          PHP, 63 bytes





                                                                                                                                                          <?=$n=$argn;while($n>9)echo"
                                                                                                                                                          ",$n=array_product(str_split($n));


                                                                                                                                                          Iterative version, call with php -nF input from STDIN.



                                                                                                                                                          Try it online!




                                                                                                                                                          PHP, 72 71 bytes





                                                                                                                                                          function h($n){echo"$n
                                                                                                                                                          ",($n=array_product(str_split($n)))>9?h($n):$n;}


                                                                                                                                                          Try it online!



                                                                                                                                                          Recursive version, as function.



                                                                                                                                                          Input: 277777788888899



                                                                                                                                                          277777788888899
                                                                                                                                                          4996238671872
                                                                                                                                                          438939648
                                                                                                                                                          4478976
                                                                                                                                                          338688
                                                                                                                                                          27648
                                                                                                                                                          2688
                                                                                                                                                          768
                                                                                                                                                          336
                                                                                                                                                          54
                                                                                                                                                          20
                                                                                                                                                          0


                                                                                                                                                          Input: 23



                                                                                                                                                          23
                                                                                                                                                          6





                                                                                                                                                          share|improve this answer











                                                                                                                                                          $endgroup$


















                                                                                                                                                            4












                                                                                                                                                            $begingroup$


                                                                                                                                                            PHP, 63 bytes





                                                                                                                                                            <?=$n=$argn;while($n>9)echo"
                                                                                                                                                            ",$n=array_product(str_split($n));


                                                                                                                                                            Iterative version, call with php -nF input from STDIN.



                                                                                                                                                            Try it online!




                                                                                                                                                            PHP, 72 71 bytes





                                                                                                                                                            function h($n){echo"$n
                                                                                                                                                            ",($n=array_product(str_split($n)))>9?h($n):$n;}


                                                                                                                                                            Try it online!



                                                                                                                                                            Recursive version, as function.



                                                                                                                                                            Input: 277777788888899



                                                                                                                                                            277777788888899
                                                                                                                                                            4996238671872
                                                                                                                                                            438939648
                                                                                                                                                            4478976
                                                                                                                                                            338688
                                                                                                                                                            27648
                                                                                                                                                            2688
                                                                                                                                                            768
                                                                                                                                                            336
                                                                                                                                                            54
                                                                                                                                                            20
                                                                                                                                                            0


                                                                                                                                                            Input: 23



                                                                                                                                                            23
                                                                                                                                                            6





                                                                                                                                                            share|improve this answer











                                                                                                                                                            $endgroup$
















                                                                                                                                                              4












                                                                                                                                                              4








                                                                                                                                                              4





                                                                                                                                                              $begingroup$


                                                                                                                                                              PHP, 63 bytes





                                                                                                                                                              <?=$n=$argn;while($n>9)echo"
                                                                                                                                                              ",$n=array_product(str_split($n));


                                                                                                                                                              Iterative version, call with php -nF input from STDIN.



                                                                                                                                                              Try it online!




                                                                                                                                                              PHP, 72 71 bytes





                                                                                                                                                              function h($n){echo"$n
                                                                                                                                                              ",($n=array_product(str_split($n)))>9?h($n):$n;}


                                                                                                                                                              Try it online!



                                                                                                                                                              Recursive version, as function.



                                                                                                                                                              Input: 277777788888899



                                                                                                                                                              277777788888899
                                                                                                                                                              4996238671872
                                                                                                                                                              438939648
                                                                                                                                                              4478976
                                                                                                                                                              338688
                                                                                                                                                              27648
                                                                                                                                                              2688
                                                                                                                                                              768
                                                                                                                                                              336
                                                                                                                                                              54
                                                                                                                                                              20
                                                                                                                                                              0


                                                                                                                                                              Input: 23



                                                                                                                                                              23
                                                                                                                                                              6





                                                                                                                                                              share|improve this answer











                                                                                                                                                              $endgroup$




                                                                                                                                                              PHP, 63 bytes





                                                                                                                                                              <?=$n=$argn;while($n>9)echo"
                                                                                                                                                              ",$n=array_product(str_split($n));


                                                                                                                                                              Iterative version, call with php -nF input from STDIN.



                                                                                                                                                              Try it online!




                                                                                                                                                              PHP, 72 71 bytes





                                                                                                                                                              function h($n){echo"$n
                                                                                                                                                              ",($n=array_product(str_split($n)))>9?h($n):$n;}


                                                                                                                                                              Try it online!



                                                                                                                                                              Recursive version, as function.



                                                                                                                                                              Input: 277777788888899



                                                                                                                                                              277777788888899
                                                                                                                                                              4996238671872
                                                                                                                                                              438939648
                                                                                                                                                              4478976
                                                                                                                                                              338688
                                                                                                                                                              27648
                                                                                                                                                              2688
                                                                                                                                                              768
                                                                                                                                                              336
                                                                                                                                                              54
                                                                                                                                                              20
                                                                                                                                                              0


                                                                                                                                                              Input: 23



                                                                                                                                                              23
                                                                                                                                                              6






                                                                                                                                                              share|improve this answer














                                                                                                                                                              share|improve this answer



                                                                                                                                                              share|improve this answer








                                                                                                                                                              edited yesterday

























                                                                                                                                                              answered yesterday









                                                                                                                                                              gwaughgwaugh

                                                                                                                                                              1,938515




                                                                                                                                                              1,938515























                                                                                                                                                                  4












                                                                                                                                                                  $begingroup$


                                                                                                                                                                  J, 16 bytes



                                                                                                                                                                  ([:*/,.&.":)^:a:


                                                                                                                                                                  Try it online!






                                                                                                                                                                  share|improve this answer









                                                                                                                                                                  $endgroup$


















                                                                                                                                                                    4












                                                                                                                                                                    $begingroup$


                                                                                                                                                                    J, 16 bytes



                                                                                                                                                                    ([:*/,.&.":)^:a:


                                                                                                                                                                    Try it online!






                                                                                                                                                                    share|improve this answer









                                                                                                                                                                    $endgroup$
















                                                                                                                                                                      4












                                                                                                                                                                      4








                                                                                                                                                                      4





                                                                                                                                                                      $begingroup$


                                                                                                                                                                      J, 16 bytes



                                                                                                                                                                      ([:*/,.&.":)^:a:


                                                                                                                                                                      Try it online!






                                                                                                                                                                      share|improve this answer









                                                                                                                                                                      $endgroup$




                                                                                                                                                                      J, 16 bytes



                                                                                                                                                                      ([:*/,.&.":)^:a:


                                                                                                                                                                      Try it online!







                                                                                                                                                                      share|improve this answer












                                                                                                                                                                      share|improve this answer



                                                                                                                                                                      share|improve this answer










                                                                                                                                                                      answered yesterday









                                                                                                                                                                      Galen IvanovGalen Ivanov

                                                                                                                                                                      7,24211034




                                                                                                                                                                      7,24211034























                                                                                                                                                                          4












                                                                                                                                                                          $begingroup$


                                                                                                                                                                          Ruby, 38 35 34 bytes





                                                                                                                                                                          f=->n{p(n)>9&&f[eval n.digits*?*]}


                                                                                                                                                                          Try it online!



                                                                                                                                                                          1 byte saved by by G B.






                                                                                                                                                                          share|improve this answer











                                                                                                                                                                          $endgroup$


















                                                                                                                                                                            4












                                                                                                                                                                            $begingroup$


                                                                                                                                                                            Ruby, 38 35 34 bytes





                                                                                                                                                                            f=->n{p(n)>9&&f[eval n.digits*?*]}


                                                                                                                                                                            Try it online!



                                                                                                                                                                            1 byte saved by by G B.






                                                                                                                                                                            share|improve this answer











                                                                                                                                                                            $endgroup$
















                                                                                                                                                                              4












                                                                                                                                                                              4








                                                                                                                                                                              4





                                                                                                                                                                              $begingroup$


                                                                                                                                                                              Ruby, 38 35 34 bytes





                                                                                                                                                                              f=->n{p(n)>9&&f[eval n.digits*?*]}


                                                                                                                                                                              Try it online!



                                                                                                                                                                              1 byte saved by by G B.






                                                                                                                                                                              share|improve this answer











                                                                                                                                                                              $endgroup$




                                                                                                                                                                              Ruby, 38 35 34 bytes





                                                                                                                                                                              f=->n{p(n)>9&&f[eval n.digits*?*]}


                                                                                                                                                                              Try it online!



                                                                                                                                                                              1 byte saved by by G B.







                                                                                                                                                                              share|improve this answer














                                                                                                                                                                              share|improve this answer



                                                                                                                                                                              share|improve this answer








                                                                                                                                                                              edited 21 hours ago

























                                                                                                                                                                              answered yesterday









                                                                                                                                                                              Kirill L.Kirill L.

                                                                                                                                                                              5,6831525




                                                                                                                                                                              5,6831525























                                                                                                                                                                                  3












                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  Brachylog, 7 bytes



                                                                                                                                                                                  ẉ?Ḋ|ẹ×↰


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Explanation



                                                                                                                                                                                  ẉ          Write the input followed by a linebreak
                                                                                                                                                                                  ?Ḋ If the input is a single digit, then it's over
                                                                                                                                                                                  | Otherwise
                                                                                                                                                                                  ẹ Split the input into a list of digits
                                                                                                                                                                                  × Multiply them together
                                                                                                                                                                                  ↰ Recursive call with the result of the multiplication as input





                                                                                                                                                                                  share|improve this answer









                                                                                                                                                                                  $endgroup$













                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    I gave it a try myself. Forgot about the Ḋ. The rest i had the same.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Kroppeb
                                                                                                                                                                                    yesterday


















                                                                                                                                                                                  3












                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  Brachylog, 7 bytes



                                                                                                                                                                                  ẉ?Ḋ|ẹ×↰


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Explanation



                                                                                                                                                                                  ẉ          Write the input followed by a linebreak
                                                                                                                                                                                  ?Ḋ If the input is a single digit, then it's over
                                                                                                                                                                                  | Otherwise
                                                                                                                                                                                  ẹ Split the input into a list of digits
                                                                                                                                                                                  × Multiply them together
                                                                                                                                                                                  ↰ Recursive call with the result of the multiplication as input





                                                                                                                                                                                  share|improve this answer









                                                                                                                                                                                  $endgroup$













                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    I gave it a try myself. Forgot about the Ḋ. The rest i had the same.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Kroppeb
                                                                                                                                                                                    yesterday
















                                                                                                                                                                                  3












                                                                                                                                                                                  3








                                                                                                                                                                                  3





                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  Brachylog, 7 bytes



                                                                                                                                                                                  ẉ?Ḋ|ẹ×↰


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Explanation



                                                                                                                                                                                  ẉ          Write the input followed by a linebreak
                                                                                                                                                                                  ?Ḋ If the input is a single digit, then it's over
                                                                                                                                                                                  | Otherwise
                                                                                                                                                                                  ẹ Split the input into a list of digits
                                                                                                                                                                                  × Multiply them together
                                                                                                                                                                                  ↰ Recursive call with the result of the multiplication as input





                                                                                                                                                                                  share|improve this answer









                                                                                                                                                                                  $endgroup$




                                                                                                                                                                                  Brachylog, 7 bytes



                                                                                                                                                                                  ẉ?Ḋ|ẹ×↰


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Explanation



                                                                                                                                                                                  ẉ          Write the input followed by a linebreak
                                                                                                                                                                                  ?Ḋ If the input is a single digit, then it's over
                                                                                                                                                                                  | Otherwise
                                                                                                                                                                                  ẹ Split the input into a list of digits
                                                                                                                                                                                  × Multiply them together
                                                                                                                                                                                  ↰ Recursive call with the result of the multiplication as input






                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                  share|improve this answer










                                                                                                                                                                                  answered yesterday









                                                                                                                                                                                  FatalizeFatalize

                                                                                                                                                                                  27.8k448136




                                                                                                                                                                                  27.8k448136












                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    I gave it a try myself. Forgot about the Ḋ. The rest i had the same.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Kroppeb
                                                                                                                                                                                    yesterday




















                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    I gave it a try myself. Forgot about the Ḋ. The rest i had the same.
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Kroppeb
                                                                                                                                                                                    yesterday


















                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  I gave it a try myself. Forgot about the Ḋ. The rest i had the same.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Kroppeb
                                                                                                                                                                                  yesterday






                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  I gave it a try myself. Forgot about the Ḋ. The rest i had the same.
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Kroppeb
                                                                                                                                                                                  yesterday













                                                                                                                                                                                  3












                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  JavaScript (Babel Node), 46 bytes





                                                                                                                                                                                  f=a=>a>9?[a,...f(eval([...a+''].join`*`))]:[a]


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  JavaScript (Babel Node), 44 bytes



                                                                                                                                                                                  If the input can be taken as String





                                                                                                                                                                                  f=a=>a>9?[a,...f(''+eval([...a].join`*`))]:a


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$













                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Arnauld Yes, I just edited and added the wrong code. Im still looking for something using only strings instead arrays
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Luis felipe De jesus Munoz
                                                                                                                                                                                    yesterday
















                                                                                                                                                                                  3












                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  JavaScript (Babel Node), 46 bytes





                                                                                                                                                                                  f=a=>a>9?[a,...f(eval([...a+''].join`*`))]:[a]


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  JavaScript (Babel Node), 44 bytes



                                                                                                                                                                                  If the input can be taken as String





                                                                                                                                                                                  f=a=>a>9?[a,...f(''+eval([...a].join`*`))]:a


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$













                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Arnauld Yes, I just edited and added the wrong code. Im still looking for something using only strings instead arrays
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Luis felipe De jesus Munoz
                                                                                                                                                                                    yesterday














                                                                                                                                                                                  3












                                                                                                                                                                                  3








                                                                                                                                                                                  3





                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  JavaScript (Babel Node), 46 bytes





                                                                                                                                                                                  f=a=>a>9?[a,...f(eval([...a+''].join`*`))]:[a]


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  JavaScript (Babel Node), 44 bytes



                                                                                                                                                                                  If the input can be taken as String





                                                                                                                                                                                  f=a=>a>9?[a,...f(''+eval([...a].join`*`))]:a


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$




                                                                                                                                                                                  JavaScript (Babel Node), 46 bytes





                                                                                                                                                                                  f=a=>a>9?[a,...f(eval([...a+''].join`*`))]:[a]


                                                                                                                                                                                  Try it online!






                                                                                                                                                                                  JavaScript (Babel Node), 44 bytes



                                                                                                                                                                                  If the input can be taken as String





                                                                                                                                                                                  f=a=>a>9?[a,...f(''+eval([...a].join`*`))]:a


                                                                                                                                                                                  Try it online!







                                                                                                                                                                                  share|improve this answer














                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                  share|improve this answer








                                                                                                                                                                                  edited yesterday

























                                                                                                                                                                                  answered yesterday









                                                                                                                                                                                  Luis felipe De jesus MunozLuis felipe De jesus Munoz

                                                                                                                                                                                  5,67821671




                                                                                                                                                                                  5,67821671












                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Arnauld Yes, I just edited and added the wrong code. Im still looking for something using only strings instead arrays
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Luis felipe De jesus Munoz
                                                                                                                                                                                    yesterday


















                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    @Arnauld Yes, I just edited and added the wrong code. Im still looking for something using only strings instead arrays
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – Luis felipe De jesus Munoz
                                                                                                                                                                                    yesterday
















                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  @Arnauld Yes, I just edited and added the wrong code. Im still looking for something using only strings instead arrays
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Luis felipe De jesus Munoz
                                                                                                                                                                                  yesterday




                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  @Arnauld Yes, I just edited and added the wrong code. Im still looking for something using only strings instead arrays
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – Luis felipe De jesus Munoz
                                                                                                                                                                                  yesterday











                                                                                                                                                                                  3












                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  PowerShell, 64 59 bytes





                                                                                                                                                                                  for($a="$args";9-lt$a){$a;$a="$(($a|% t*y)-join'*'|iex)"}$a


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Iterative method. Takes input and stores it into $a, then enters a for loop so long as the length of $a is two or more (i.e., it's bigger than 9). Inside the loop we output $a and then recalculate it by converting it toCharArray, joining it together with *, and then iex (short for Invoke-Expression and similar to eval). Once we're out of the loop, we have a single digit left to print, so we place $a onto the pipeline again.



                                                                                                                                                                                  -5 bytes thanks to KGlasier.






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$













                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    You could use the comparison 9-lt$a instead of $a.length-1 to save 5 bytes. And if you didn't go string based the whole time you could cut off a decent chunk. Check out my powershell attempt if you want!
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – KGlasier
                                                                                                                                                                                    yesterday
















                                                                                                                                                                                  3












                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  PowerShell, 64 59 bytes





                                                                                                                                                                                  for($a="$args";9-lt$a){$a;$a="$(($a|% t*y)-join'*'|iex)"}$a


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Iterative method. Takes input and stores it into $a, then enters a for loop so long as the length of $a is two or more (i.e., it's bigger than 9). Inside the loop we output $a and then recalculate it by converting it toCharArray, joining it together with *, and then iex (short for Invoke-Expression and similar to eval). Once we're out of the loop, we have a single digit left to print, so we place $a onto the pipeline again.



                                                                                                                                                                                  -5 bytes thanks to KGlasier.






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$













                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    You could use the comparison 9-lt$a instead of $a.length-1 to save 5 bytes. And if you didn't go string based the whole time you could cut off a decent chunk. Check out my powershell attempt if you want!
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – KGlasier
                                                                                                                                                                                    yesterday














                                                                                                                                                                                  3












                                                                                                                                                                                  3








                                                                                                                                                                                  3





                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                  PowerShell, 64 59 bytes





                                                                                                                                                                                  for($a="$args";9-lt$a){$a;$a="$(($a|% t*y)-join'*'|iex)"}$a


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Iterative method. Takes input and stores it into $a, then enters a for loop so long as the length of $a is two or more (i.e., it's bigger than 9). Inside the loop we output $a and then recalculate it by converting it toCharArray, joining it together with *, and then iex (short for Invoke-Expression and similar to eval). Once we're out of the loop, we have a single digit left to print, so we place $a onto the pipeline again.



                                                                                                                                                                                  -5 bytes thanks to KGlasier.






                                                                                                                                                                                  share|improve this answer











                                                                                                                                                                                  $endgroup$




                                                                                                                                                                                  PowerShell, 64 59 bytes





                                                                                                                                                                                  for($a="$args";9-lt$a){$a;$a="$(($a|% t*y)-join'*'|iex)"}$a


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Iterative method. Takes input and stores it into $a, then enters a for loop so long as the length of $a is two or more (i.e., it's bigger than 9). Inside the loop we output $a and then recalculate it by converting it toCharArray, joining it together with *, and then iex (short for Invoke-Expression and similar to eval). Once we're out of the loop, we have a single digit left to print, so we place $a onto the pipeline again.



                                                                                                                                                                                  -5 bytes thanks to KGlasier.







                                                                                                                                                                                  share|improve this answer














                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                  share|improve this answer








                                                                                                                                                                                  edited yesterday

























                                                                                                                                                                                  answered yesterday









                                                                                                                                                                                  AdmBorkBorkAdmBorkBork

                                                                                                                                                                                  27.5k466237




                                                                                                                                                                                  27.5k466237












                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    You could use the comparison 9-lt$a instead of $a.length-1 to save 5 bytes. And if you didn't go string based the whole time you could cut off a decent chunk. Check out my powershell attempt if you want!
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – KGlasier
                                                                                                                                                                                    yesterday


















                                                                                                                                                                                  • $begingroup$
                                                                                                                                                                                    You could use the comparison 9-lt$a instead of $a.length-1 to save 5 bytes. And if you didn't go string based the whole time you could cut off a decent chunk. Check out my powershell attempt if you want!
                                                                                                                                                                                    $endgroup$
                                                                                                                                                                                    – KGlasier
                                                                                                                                                                                    yesterday
















                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  You could use the comparison 9-lt$a instead of $a.length-1 to save 5 bytes. And if you didn't go string based the whole time you could cut off a decent chunk. Check out my powershell attempt if you want!
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – KGlasier
                                                                                                                                                                                  yesterday




                                                                                                                                                                                  $begingroup$
                                                                                                                                                                                  You could use the comparison 9-lt$a instead of $a.length-1 to save 5 bytes. And if you didn't go string based the whole time you could cut off a decent chunk. Check out my powershell attempt if you want!
                                                                                                                                                                                  $endgroup$
                                                                                                                                                                                  – KGlasier
                                                                                                                                                                                  yesterday











                                                                                                                                                                                  3












                                                                                                                                                                                  $begingroup$

                                                                                                                                                                                  APL(NARS), 19 chars, 38 bytes



                                                                                                                                                                                  {⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}


                                                                                                                                                                                  test:



                                                                                                                                                                                     f←{⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}
                                                                                                                                                                                  f 23
                                                                                                                                                                                  23
                                                                                                                                                                                  6
                                                                                                                                                                                  f 27648
                                                                                                                                                                                  27648
                                                                                                                                                                                  2688
                                                                                                                                                                                  768
                                                                                                                                                                                  336
                                                                                                                                                                                  54
                                                                                                                                                                                  20
                                                                                                                                                                                  0





                                                                                                                                                                                  share|improve this answer









                                                                                                                                                                                  $endgroup$


















                                                                                                                                                                                    3












                                                                                                                                                                                    $begingroup$

                                                                                                                                                                                    APL(NARS), 19 chars, 38 bytes



                                                                                                                                                                                    {⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}


                                                                                                                                                                                    test:



                                                                                                                                                                                       f←{⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}
                                                                                                                                                                                    f 23
                                                                                                                                                                                    23
                                                                                                                                                                                    6
                                                                                                                                                                                    f 27648
                                                                                                                                                                                    27648
                                                                                                                                                                                    2688
                                                                                                                                                                                    768
                                                                                                                                                                                    336
                                                                                                                                                                                    54
                                                                                                                                                                                    20
                                                                                                                                                                                    0





                                                                                                                                                                                    share|improve this answer









                                                                                                                                                                                    $endgroup$
















                                                                                                                                                                                      3












                                                                                                                                                                                      3








                                                                                                                                                                                      3





                                                                                                                                                                                      $begingroup$

                                                                                                                                                                                      APL(NARS), 19 chars, 38 bytes



                                                                                                                                                                                      {⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}


                                                                                                                                                                                      test:



                                                                                                                                                                                         f←{⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}
                                                                                                                                                                                      f 23
                                                                                                                                                                                      23
                                                                                                                                                                                      6
                                                                                                                                                                                      f 27648
                                                                                                                                                                                      27648
                                                                                                                                                                                      2688
                                                                                                                                                                                      768
                                                                                                                                                                                      336
                                                                                                                                                                                      54
                                                                                                                                                                                      20
                                                                                                                                                                                      0





                                                                                                                                                                                      share|improve this answer









                                                                                                                                                                                      $endgroup$



                                                                                                                                                                                      APL(NARS), 19 chars, 38 bytes



                                                                                                                                                                                      {⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}


                                                                                                                                                                                      test:



                                                                                                                                                                                         f←{⍵≤9:⍵⋄∇×/⍎¨⍕⍵⊣⎕←⍵}
                                                                                                                                                                                      f 23
                                                                                                                                                                                      23
                                                                                                                                                                                      6
                                                                                                                                                                                      f 27648
                                                                                                                                                                                      27648
                                                                                                                                                                                      2688
                                                                                                                                                                                      768
                                                                                                                                                                                      336
                                                                                                                                                                                      54
                                                                                                                                                                                      20
                                                                                                                                                                                      0






                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                      share|improve this answer










                                                                                                                                                                                      answered yesterday









                                                                                                                                                                                      RosLuPRosLuP

                                                                                                                                                                                      2,286514




                                                                                                                                                                                      2,286514























                                                                                                                                                                                          3












                                                                                                                                                                                          $begingroup$


                                                                                                                                                                                          Charcoal, 13 bytes



                                                                                                                                                                                          θW⊖Lθ«≔IΠθθ⸿θ


                                                                                                                                                                                          Try it online! Link is to verbose version of code. Explanation:



                                                                                                                                                                                          θ


                                                                                                                                                                                          Print the input for the first time.



                                                                                                                                                                                          W⊖Lθ«


                                                                                                                                                                                          Repeat while the length of the input is not 1.



                                                                                                                                                                                          ≔IΠθθ


                                                                                                                                                                                          Replace the input with its digital product cast to string.



                                                                                                                                                                                          ⸿θ


                                                                                                                                                                                          Print the input on a new line.






                                                                                                                                                                                          share|improve this answer









                                                                                                                                                                                          $endgroup$


















                                                                                                                                                                                            3












                                                                                                                                                                                            $begingroup$


                                                                                                                                                                                            Charcoal, 13 bytes



                                                                                                                                                                                            θW⊖Lθ«≔IΠθθ⸿θ


                                                                                                                                                                                            Try it online! Link is to verbose version of code. Explanation:



                                                                                                                                                                                            θ


                                                                                                                                                                                            Print the input for the first time.



                                                                                                                                                                                            W⊖Lθ«


                                                                                                                                                                                            Repeat while the length of the input is not 1.



                                                                                                                                                                                            ≔IΠθθ


                                                                                                                                                                                            Replace the input with its digital product cast to string.



                                                                                                                                                                                            ⸿θ


                                                                                                                                                                                            Print the input on a new line.






                                                                                                                                                                                            share|improve this answer









                                                                                                                                                                                            $endgroup$
















                                                                                                                                                                                              3












                                                                                                                                                                                              3








                                                                                                                                                                                              3





                                                                                                                                                                                              $begingroup$


                                                                                                                                                                                              Charcoal, 13 bytes



                                                                                                                                                                                              θW⊖Lθ«≔IΠθθ⸿θ


                                                                                                                                                                                              Try it online! Link is to verbose version of code. Explanation:



                                                                                                                                                                                              θ


                                                                                                                                                                                              Print the input for the first time.



                                                                                                                                                                                              W⊖Lθ«


                                                                                                                                                                                              Repeat while the length of the input is not 1.



                                                                                                                                                                                              ≔IΠθθ


                                                                                                                                                                                              Replace the input with its digital product cast to string.



                                                                                                                                                                                              ⸿θ


                                                                                                                                                                                              Print the input on a new line.






                                                                                                                                                                                              share|improve this answer









                                                                                                                                                                                              $endgroup$




                                                                                                                                                                                              Charcoal, 13 bytes



                                                                                                                                                                                              θW⊖Lθ«≔IΠθθ⸿θ


                                                                                                                                                                                              Try it online! Link is to verbose version of code. Explanation:



                                                                                                                                                                                              θ


                                                                                                                                                                                              Print the input for the first time.



                                                                                                                                                                                              W⊖Lθ«


                                                                                                                                                                                              Repeat while the length of the input is not 1.



                                                                                                                                                                                              ≔IΠθθ


                                                                                                                                                                                              Replace the input with its digital product cast to string.



                                                                                                                                                                                              ⸿θ


                                                                                                                                                                                              Print the input on a new line.







                                                                                                                                                                                              share|improve this answer












                                                                                                                                                                                              share|improve this answer



                                                                                                                                                                                              share|improve this answer










                                                                                                                                                                                              answered yesterday









                                                                                                                                                                                              NeilNeil

                                                                                                                                                                                              82k745178




                                                                                                                                                                                              82k745178























                                                                                                                                                                                                  2












                                                                                                                                                                                                  $begingroup$


                                                                                                                                                                                                  Retina, 24 bytes



                                                                                                                                                                                                  .+~(`

                                                                                                                                                                                                  .
                                                                                                                                                                                                  $&$*
                                                                                                                                                                                                  ^
                                                                                                                                                                                                  .+¶$$.(


                                                                                                                                                                                                  Try it online! Explanation:



                                                                                                                                                                                                  .+~(`


                                                                                                                                                                                                  Print the current value on its own line at the start of every loop until it stops changing and don't print the unchanged value twice. Evaluate the current value at the end of each loop.



                                                                                                                                                                                                  .
                                                                                                                                                                                                  $&$*


                                                                                                                                                                                                  Add a * after each digit.



                                                                                                                                                                                                  ^
                                                                                                                                                                                                  .+¶$$.(


                                                                                                                                                                                                  Finish turning the input into an expression that evaluates to the digital product.



                                                                                                                                                                                                  Just for the record, Retina can do this in one line (25 bytes):



                                                                                                                                                                                                  .+"¶"<~[".+¶$.("|'*]'*L`.





                                                                                                                                                                                                  share|improve this answer









                                                                                                                                                                                                  $endgroup$


















                                                                                                                                                                                                    2












                                                                                                                                                                                                    $begingroup$


                                                                                                                                                                                                    Retina, 24 bytes



                                                                                                                                                                                                    .+~(`

                                                                                                                                                                                                    .
                                                                                                                                                                                                    $&$*
                                                                                                                                                                                                    ^
                                                                                                                                                                                                    .+¶$$.(


                                                                                                                                                                                                    Try it online! Explanation:



                                                                                                                                                                                                    .+~(`


                                                                                                                                                                                                    Print the current value on its own line at the start of every loop until it stops changing and don't print the unchanged value twice. Evaluate the current value at the end of each loop.



                                                                                                                                                                                                    .
                                                                                                                                                                                                    $&$*


                                                                                                                                                                                                    Add a * after each digit.



                                                                                                                                                                                                    ^
                                                                                                                                                                                                    .+¶$$.(


                                                                                                                                                                                                    Finish turning the input into an expression that evaluates to the digital product.



                                                                                                                                                                                                    Just for the record, Retina can do this in one line (25 bytes):



                                                                                                                                                                                                    .+"¶"<~[".+¶$.("|'*]'*L`.





                                                                                                                                                                                                    share|improve this answer









                                                                                                                                                                                                    $endgroup$
















                                                                                                                                                                                                      2












                                                                                                                                                                                                      2








                                                                                                                                                                                                      2





                                                                                                                                                                                                      $begingroup$


                                                                                                                                                                                                      Retina, 24 bytes



                                                                                                                                                                                                      .+~(`

                                                                                                                                                                                                      .
                                                                                                                                                                                                      $&$*
                                                                                                                                                                                                      ^
                                                                                                                                                                                                      .+¶$$.(


                                                                                                                                                                                                      Try it online! Explanation:



                                                                                                                                                                                                      .+~(`


                                                                                                                                                                                                      Print the current value on its own line at the start of every loop until it stops changing and don't print the unchanged value twice. Evaluate the current value at the end of each loop.



                                                                                                                                                                                                      .
                                                                                                                                                                                                      $&$*


                                                                                                                                                                                                      Add a * after each digit.



                                                                                                                                                                                                      ^
                                                                                                                                                                                                      .+¶$$.(


                                                                                                                                                                                                      Finish turning the input into an expression that evaluates to the digital product.



                                                                                                                                                                                                      Just for the record, Retina can do this in one line (25 bytes):



                                                                                                                                                                                                      .+"¶"<~[".+¶$.("|'*]'*L`.





                                                                                                                                                                                                      share|improve this answer









                                                                                                                                                                                                      $endgroup$




                                                                                                                                                                                                      Retina, 24 bytes



                                                                                                                                                                                                      .+~(`

                                                                                                                                                                                                      .
                                                                                                                                                                                                      $&$*
                                                                                                                                                                                                      ^
                                                                                                                                                                                                      .+¶$$.(


                                                                                                                                                                                                      Try it online! Explanation:



                                                                                                                                                                                                      .+~(`


                                                                                                                                                                                                      Print the current value on its own line at the start of every loop until it stops changing and don't print the unchanged value twice. Evaluate the current value at the end of each loop.



                                                                                                                                                                                                      .
                                                                                                                                                                                                      $&$*


                                                                                                                                                                                                      Add a * after each digit.



                                                                                                                                                                                                      ^
                                                                                                                                                                                                      .+¶$$.(


                                                                                                                                                                                                      Finish turning the input into an expression that evaluates to the digital product.



                                                                                                                                                                                                      Just for the record, Retina can do this in one line (25 bytes):



                                                                                                                                                                                                      .+"¶"<~[".+¶$.("|'*]'*L`.






                                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                                      share|improve this answer










                                                                                                                                                                                                      answered yesterday









                                                                                                                                                                                                      NeilNeil

                                                                                                                                                                                                      82k745178




                                                                                                                                                                                                      82k745178























                                                                                                                                                                                                          2












                                                                                                                                                                                                          $begingroup$

                                                                                                                                                                                                          Java, 112 bytes



                                                                                                                                                                                                          "Lossy conversion" thanks Java for the extra ~15 bytes


                                                                                                                                                                                                          Obligatory stream abuse recursion answer



                                                                                                                                                                                                          long f(long n){System.out.println(n);return n<10?n:f((n+"").chars().mapToLong(i->i).reduce(1,(x,y)->x*(y-48)));}


                                                                                                                                                                                                          Try it online






                                                                                                                                                                                                          share|improve this answer









                                                                                                                                                                                                          $endgroup$













                                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                                            I'm pretty sure you only need to support int
                                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                                            – Embodiment of Ignorance
                                                                                                                                                                                                            5 hours ago
















                                                                                                                                                                                                          2












                                                                                                                                                                                                          $begingroup$

                                                                                                                                                                                                          Java, 112 bytes



                                                                                                                                                                                                          "Lossy conversion" thanks Java for the extra ~15 bytes


                                                                                                                                                                                                          Obligatory stream abuse recursion answer



                                                                                                                                                                                                          long f(long n){System.out.println(n);return n<10?n:f((n+"").chars().mapToLong(i->i).reduce(1,(x,y)->x*(y-48)));}


                                                                                                                                                                                                          Try it online






                                                                                                                                                                                                          share|improve this answer









                                                                                                                                                                                                          $endgroup$













                                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                                            I'm pretty sure you only need to support int
                                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                                            – Embodiment of Ignorance
                                                                                                                                                                                                            5 hours ago














                                                                                                                                                                                                          2












                                                                                                                                                                                                          2








                                                                                                                                                                                                          2





                                                                                                                                                                                                          $begingroup$

                                                                                                                                                                                                          Java, 112 bytes



                                                                                                                                                                                                          "Lossy conversion" thanks Java for the extra ~15 bytes


                                                                                                                                                                                                          Obligatory stream abuse recursion answer



                                                                                                                                                                                                          long f(long n){System.out.println(n);return n<10?n:f((n+"").chars().mapToLong(i->i).reduce(1,(x,y)->x*(y-48)));}


                                                                                                                                                                                                          Try it online






                                                                                                                                                                                                          share|improve this answer









                                                                                                                                                                                                          $endgroup$



                                                                                                                                                                                                          Java, 112 bytes



                                                                                                                                                                                                          "Lossy conversion" thanks Java for the extra ~15 bytes


                                                                                                                                                                                                          Obligatory stream abuse recursion answer



                                                                                                                                                                                                          long f(long n){System.out.println(n);return n<10?n:f((n+"").chars().mapToLong(i->i).reduce(1,(x,y)->x*(y-48)));}


                                                                                                                                                                                                          Try it online







                                                                                                                                                                                                          share|improve this answer












                                                                                                                                                                                                          share|improve this answer



                                                                                                                                                                                                          share|improve this answer










                                                                                                                                                                                                          answered yesterday









                                                                                                                                                                                                          Benjamin UrquhartBenjamin Urquhart

                                                                                                                                                                                                          3307




                                                                                                                                                                                                          3307












                                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                                            I'm pretty sure you only need to support int
                                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                                            – Embodiment of Ignorance
                                                                                                                                                                                                            5 hours ago


















                                                                                                                                                                                                          • $begingroup$
                                                                                                                                                                                                            I'm pretty sure you only need to support int
                                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                                            – Embodiment of Ignorance
                                                                                                                                                                                                            5 hours ago
















                                                                                                                                                                                                          $begingroup$
                                                                                                                                                                                                          I'm pretty sure you only need to support int
                                                                                                                                                                                                          $endgroup$
                                                                                                                                                                                                          – Embodiment of Ignorance
                                                                                                                                                                                                          5 hours ago




                                                                                                                                                                                                          $begingroup$
                                                                                                                                                                                                          I'm pretty sure you only need to support int
                                                                                                                                                                                                          $endgroup$
                                                                                                                                                                                                          – Embodiment of Ignorance
                                                                                                                                                                                                          5 hours ago











                                                                                                                                                                                                          2












                                                                                                                                                                                                          $begingroup$

                                                                                                                                                                                                          Swift, 115 bytes



                                                                                                                                                                                                          func m(a:Int){
                                                                                                                                                                                                          print("(a)")
                                                                                                                                                                                                          var b=1,c=a
                                                                                                                                                                                                          while c>0{
                                                                                                                                                                                                          b*=c%10
                                                                                                                                                                                                          c/=10}
                                                                                                                                                                                                          b>9 ? m(a:b):print("(b)")}
                                                                                                                                                                                                          m(a:277777788888899)


                                                                                                                                                                                                          Try it online!






                                                                                                                                                                                                          share|improve this answer









                                                                                                                                                                                                          $endgroup$









                                                                                                                                                                                                          • 1




                                                                                                                                                                                                            $begingroup$
                                                                                                                                                                                                            I think you can move the call to m into the Footer portion of TIO, leaving this answer as 95 bytes
                                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                                            – Giuseppe
                                                                                                                                                                                                            yesterday
















                                                                                                                                                                                                          2












                                                                                                                                                                                                          $begingroup$

                                                                                                                                                                                                          Swift, 115 bytes



                                                                                                                                                                                                          func m(a:Int){
                                                                                                                                                                                                          print("(a)")
                                                                                                                                                                                                          var b=1,c=a
                                                                                                                                                                                                          while c>0{
                                                                                                                                                                                                          b*=c%10
                                                                                                                                                                                                          c/=10}
                                                                                                                                                                                                          b>9 ? m(a:b):print("(b)")}
                                                                                                                                                                                                          m(a:277777788888899)


                                                                                                                                                                                                          Try it online!






                                                                                                                                                                                                          share|improve this answer









                                                                                                                                                                                                          $endgroup$









                                                                                                                                                                                                          • 1




                                                                                                                                                                                                            $begingroup$
                                                                                                                                                                                                            I think you can move the call to m into the Footer portion of TIO, leaving this answer as 95 bytes
                                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                                            – Giuseppe
                                                                                                                                                                                                            yesterday














                                                                                                                                                                                                          2












                                                                                                                                                                                                          2








                                                                                                                                                                                                          2





                                                                                                                                                                                                          $begingroup$

                                                                                                                                                                                                          Swift, 115 bytes



                                                                                                                                                                                                          func m(a:Int){
                                                                                                                                                                                                          print("(a)")
                                                                                                                                                                                                          var b=1,c=a
                                                                                                                                                                                                          while c>0{
                                                                                                                                                                                                          b*=c%10
                                                                                                                                                                                                          c/=10}
                                                                                                                                                                                                          b>9 ? m(a:b):print("(b)")}
                                                                                                                                                                                                          m(a:277777788888899)


                                                                                                                                                                                                          Try it online!






                                                                                                                                                                                                          share|improve this answer









                                                                                                                                                                                                          $endgroup$



                                                                                                                                                                                                          Swift, 115 bytes



                                                                                                                                                                                                          func m(a:Int){
                                                                                                                                                                                                          print("(a)")
                                                                                                                                                                                                          var b=1,c=a
                                                                                                                                                                                                          while c>0{
                                                                                                                                                                                                          b*=c%10
                                                                                                                                                                                                          c/=10}
                                                                                                                                                                                                          b>9 ? m(a:b):print("(b)")}
                                                                                                                                                                                                          m(a:277777788888899)


                                                                                                                                                                                                          Try it online!







                                                                                                                                                                                                          share|improve this answer












                                                                                                                                                                                                          share|improve this answer



                                                                                                                                                                                                          share|improve this answer










                                                                                                                                                                                                          answered yesterday









                                                                                                                                                                                                          onnowebonnoweb

                                                                                                                                                                                                          1512




                                                                                                                                                                                                          1512








                                                                                                                                                                                                          • 1




                                                                                                                                                                                                            $begingroup$
                                                                                                                                                                                                            I think you can move the call to m into the Footer portion of TIO, leaving this answer as 95 bytes
                                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                                            – Giuseppe
                                                                                                                                                                                                            yesterday














                                                                                                                                                                                                          • 1




                                                                                                                                                                                                            $begingroup$
                                                                                                                                                                                                            I think you can move the call to m into the Footer portion of TIO, leaving this answer as 95 bytes
                                                                                                                                                                                                            $endgroup$
                                                                                                                                                                                                            – Giuseppe
                                                                                                                                                                                                            yesterday








                                                                                                                                                                                                          1




                                                                                                                                                                                                          1




                                                                                                                                                                                                          $begingroup$
                                                                                                                                                                                                          I think you can move the call to m into the Footer portion of TIO, leaving this answer as 95 bytes
                                                                                                                                                                                                          $endgroup$
                                                                                                                                                                                                          – Giuseppe
                                                                                                                                                                                                          yesterday




                                                                                                                                                                                                          $begingroup$
                                                                                                                                                                                                          I think you can move the call to m into the Footer portion of TIO, leaving this answer as 95 bytes
                                                                                                                                                                                                          $endgroup$
                                                                                                                                                                                                          – Giuseppe
                                                                                                                                                                                                          yesterday










                                                                                                                                                                                                          1 2
                                                                                                                                                                                                          next

















                                                                                                                                                                                                          draft saved

                                                                                                                                                                                                          draft discarded




















































                                                                                                                                                                                                          If this is an answer to a challenge…




                                                                                                                                                                                                          • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                                                                                                                                          • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                                                                                                                                            Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                                                                                                                                          • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                                                                                                                                          More generally…




                                                                                                                                                                                                          • …Please make sure to answer the question and provide sufficient detail.


                                                                                                                                                                                                          • …Avoid asking for help, clarification or responding to other answers (use comments instead).





                                                                                                                                                                                                          draft saved


                                                                                                                                                                                                          draft discarded














                                                                                                                                                                                                          StackExchange.ready(
                                                                                                                                                                                                          function () {
                                                                                                                                                                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181958%2fmultiplicative-persistence%23new-answer', 'question_page');
                                                                                                                                                                                                          }
                                                                                                                                                                                                          );

                                                                                                                                                                                                          Post as a guest















                                                                                                                                                                                                          Required, but never shown





















































                                                                                                                                                                                                          Required, but never shown














                                                                                                                                                                                                          Required, but never shown












                                                                                                                                                                                                          Required, but never shown







                                                                                                                                                                                                          Required, but never shown

































                                                                                                                                                                                                          Required, but never shown














                                                                                                                                                                                                          Required, but never shown












                                                                                                                                                                                                          Required, but never shown







                                                                                                                                                                                                          Required, but never shown







                                                                                                                                                                                                          Popular posts from this blog

                                                                                                                                                                                                          數位音樂下載

                                                                                                                                                                                                          When can things happen in Etherscan, such as the picture below?

                                                                                                                                                                                                          格利澤436b