login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A339597 When 2*n+1 first appears in A086799. 5
1, 2, 5, 4, 9, 10, 13, 8, 17, 18, 21, 20, 25, 26, 29, 16, 33, 34, 37, 36, 41, 42, 45, 40, 49, 50, 53, 52, 57, 58, 61, 32, 65, 66, 69, 68, 73, 74, 77, 72, 81, 82, 85, 84, 89, 90, 93, 80, 97, 98, 101, 100, 105, 106, 109, 104, 113, 114, 117, 116, 121, 122, 125, 64, 129, 130, 133, 132, 137 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
LINKS
Christian Krause, LODA program
FORMULA
a(n) = 2*(n+1) - A006519(n+1) = n+1 with a 0 bit inserted above its least significant 1-bit. - Kevin Ryde, Mar 29 2021
a(n) = A129760(n+1) + n+1. - Christian Krause, May 05 2021
MAPLE
N := 127: # for a(0) to a(N)
V := Array(0..N): count := 0:
for i from 1 while count < N+1 do
with(MmaTranslator[Mma]):
f(i) := BitOr(i, i-1);
v := (f(i)-1)/2;
if v <= N and V[v] = 0 then count := count+1; V[v] := i fi
od:
convert(V, list); # Robert Israel, Jan 07 2021
PROG
(PARI) f(n) = bitor(n, n-1); \\ A086799
a(n) = my(k=1); while (f(k) != 2*n+1, k++); k; \\ Michel Marcus, Jan 07 2021
(PARI) a(n) = n++; n<<1 - 1<<valuation(n, 2); \\ Kevin Ryde, Mar 29 2021
(Python)
def A339597(n): return ((m:=n+1)<<1)-(m&-m) # Chai Wah Wu, Sep 01 2023
CROSSREFS
Cf. A086799, A091072 (terms sorted), A129760.
Sequence in context: A204923 A123302 A227368 * A368736 A120119 A364035
KEYWORD
nonn,easy
AUTHOR
Marc LeBrun and N. J. A. Sloane, Jan 06 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 03:08 EDT 2024. Contains 371918 sequences. (Running on oeis4.)