Advertisement
Didart

Sequence 2k+1

Apr 9th, 2022
653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sequence2kPlus1(input) {
  2.  
  3.     let n = Number(input[0]);
  4.  
  5.     let k = 1;
  6.  
  7.     while (k <= n) {
  8.         console.log(k);
  9.  
  10.         k = k * 2 + 1;
  11.     }
  12.  
  13. }
  14.  
  15. sequence2kPlus1(["3"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement