Question I am trying to code a function that calculates a “Shaffer” number. So a “Shaffer” number starts with 1, then each successive number is equal to double the current number, and then 3 added to that. So, first few numbers are as follows: 1 // Now double it, plus 3 5 // Now double it, plus 3 13 // etc. I am getting stuck when it pulls the wrong value out. For example, my code pulls the number 5, when it should be 61.
Question
I am trying to code a function that calculates a “Shaffer” number. So a “Shaffer” number starts
with 1, then each successive number is equal to double the current number, and then 3 added to that. So, first few numbers are as follows:
1 // Now double it, plus 3
5 // Now double it, plus 3
13 // etc.
I am getting stuck when it pulls the wrong value out. For example, my code pulls the number 5, when it should be 61.