User blog comment:VoidSansXD/My attempt at not creating a recursive function/@comment-37246647-20190209234852/@comment-37246647-20190210034710

The formula for J(n): 2c+(s-2), where s is the first step involving the prime, and c is the last composite number before the prime.