by Samrat Mukherjee
Last Updated September 12, 2019 04:20 AM

I have generated a sequence which looks really simple : $f(n) = 0, 1, 1, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 15 ....n$

The indices are having the same values in the order of $(2*i)$ where $i = 0,1,2,3...$

If possible, please help me generate it's formula.

Thank you

Assuming your function is f(1)=0, f(2)=f(3)=1, f(4)=f(5)=f(6)=f(7)=3,...

So the formula could be $f(n)=2^{\lfloor\log_2(n)\rfloor}-1$ where $\lfloor x\rfloor$ means the largest integer no more than x.

- ServerfaultXchanger
- SuperuserXchanger
- UbuntuXchanger
- WebappsXchanger
- WebmastersXchanger
- ProgrammersXchanger
- DbaXchanger
- DrupalXchanger
- WordpressXchanger
- MagentoXchanger
- JoomlaXchanger
- AndroidXchanger
- AppleXchanger
- GameXchanger
- GamingXchanger
- BlenderXchanger
- UxXchanger
- CookingXchanger
- PhotoXchanger
- StatsXchanger
- MathXchanger
- DiyXchanger
- GisXchanger
- TexXchanger
- MetaXchanger
- ElectronicsXchanger
- StackoverflowXchanger
- BitcoinXchanger
- EthereumXcanger