Jump to content

Talk:Wagstaff primes

From Rosetta Code

3 divides all numbers of form 2n+1 when n is odd

A number is divisible by 3 if its Digital root is divisible by 3. Considering n+g=ng the Digital root of ng is the Digital root of n + the Digital root of g. Putting this together:

Digital root of 2n 2 4 8 7 5 1 2 4 8 ....
                n  1 2 3 4 5 6 7 8 9 ....

2n+1 will be divisible by 3 when when the Digital root of 2n is 2, 5, or 8 which from above corresponds to all odd values of n. Further for Wagstaff primes it can not be 8 because (2n+1)/3 will be divisible by 3.--Nigel Galloway (talk) 14:01, 15 September 2022 (UTC)

Thanks for confirming that. I suspected it was the case but wasn't sure how to prove it. I've added a note to the task description and simplified my Wren solution a bit. --PureFox (talk) 16:27, 15 September 2022 (UTC)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.