Skip to main content
Commonmark migration
Source Link

#The challenge

The challenge

#Rules

Rules

#Test cases

Test cases

#The challenge

#Rules

#Test cases

The challenge

Rules

Test cases

Corrected numbers in italics
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372

Consider for example n=25. We initiallize t = 25. Since this is not a prime nor 1, we compute f(25), which is 9. This becomes the new value for t. This is not a prime nor 1, so we continue: f(9) is 44. We continue again: f(4) is 22. Since this is a prime we stop here. We have done 3 iterations (from 25 to 9, then to 4, then to 2). Thus s(25) is 3.

Consider for example n=25. We initiallize t = 25. Since this is not a prime nor 1, we compute f(25), which is 9. This becomes the new value for t. This is not a prime nor 1, so we continue: f(9) is 4. We continue again: f(4) is 2. Since this is a prime we stop here. We have done 3 iterations (from 25 to 9, then to 4, then to 2). Thus s(25) is 3.

Consider for example n=25. We initiallize t = 25. Since this is not a prime nor 1, we compute f(25), which is 9. This becomes the new value for t. This is not a prime nor 1, so we continue: f(9) is 4. We continue again: f(4) is 2. Since this is a prime we stop here. We have done 3 iterations (from 25 to 9, then to 4, then to 2). Thus s(25) is 3.

Notice removed Draw attention by Luis Mendo
Bounty Ended with ngn's answer chosen by Luis Mendo
Notice added Draw attention by Luis Mendo
Bounty Started worth 200 reputation by Luis Mendo
Rollback to Revision 5
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
  • Initiallize t to n.
  • As long as t is not aneither prime nor 1, replace t by f(t) and iterate.
  • The number of iterations is s(n).
  • Initiallize t to n.
  • As long as t is not a prime, replace t by f(t) and iterate.
  • The number of iterations is s(n).
  • Initiallize t to n.
  • As long as t is neither prime nor 1, replace t by f(t) and iterate.
  • The number of iterations is s(n).
deleted 57 characters in body
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading
added 29 characters in body
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading
Simplified the description in step 1, taking into account that 1 is not a prime
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading
Clarified step 1
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading
At the new resolution the N=101 case looks worse, and it doesn't add anything, so I delete it
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading
Better resolution for images at default view
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading
Tweeted twitter.com/StackCodeGolf/status/958474448381906944
edited body
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading
Source Link
Luis Mendo
  • 105.3k
  • 9
  • 135
  • 372
Loading