How do you apply the Substantial Presence Test?

John is single and he is currently exploring the possible expansion of his business from Australia into the U.S.

He has a leased a home in West Hollywood and sold he home in Australia and when he is in the U.S. he enters pursuant to an E2 Visa (Treaty Investment Visa).  He believes that as long as he spends less than 183 days in the U.S. in a calendar year he will not be a U.S. resident for income tax purposes. In 2017 he spent 130 days in the U.S., In 2018 he spent 130 Days in the U.S. and in 2019 he expects to spend 125 days in the U.S.

Under the Substantial Presence Test, John will be a non-resident of the U.S. in 2017 (130 x 1), a non-resident of the U.S. in 2018 (130 x 1 + 130 x 1/3 = 173.3), and a resident of the U.S. in 2019 (125 x 1 + 130 x 1/3 + 130 x 1/6 = 194.99).