The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A020946 a(n) is the smallest number k such that A002487(k) = n. 5
0, 1, 3, 5, 9, 11, 33, 19, 21, 35, 39, 37, 45, 43, 69, 73, 93, 77, 75, 83, 189, 85, 141, 139, 153, 151, 147, 155, 267, 149, 165, 173, 279, 275, 171, 283, 315, 277, 537, 325, 297, 293, 579, 301, 309, 365, 333, 299, 567, 331, 339, 553, 549, 563, 1275, 341, 585, 565, 615, 629 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 0..10000
EXAMPLE
A002487(33) = 6 and this is the first time 6 appears, so a(6) = 33.
MATHEMATICA
aa = {}; a[0] = 0; a[1] = 1; a[n_] := a[n] = If[EvenQ[n], a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Do[k = 0; While[a[k] != p, k++]; AppendTo[aa, k], {p, 0, 100}]; aa (* Artur Jasinski, Dec 06 2010 *)
PROG
(PARI) fusc(n)={my(a=1, b=0); while(n, if(bitand(n, 1), b+=a, a+=b); n>>=1); b};
list(N)={
my(v=vector(N), k);
forstep(n=1, 9e99, 2,
k=fusc(n);
if(k<=N && !v[k],
v[k]=n;
if(vecmin(v), return(v))
)
)
}; \\ Charles R Greathouse IV, Dec 20 2011
(Python)
from itertools import count
from functools import reduce
def A020946(n): return next(filter(lambda k:sum(reduce(lambda x, y:(x[0], x[0]+x[1]) if int(y) else (x[0]+x[1], x[1]), bin(k)[-1:2:-1], (1, 0)))==n, count(1))) if n else 0 # Chai Wah Wu, May 05 2023
CROSSREFS
Equals A020950 + 1.
Sequence in context: A160358 A319084 A120806 * A352596 A304525 A310039
KEYWORD
nonn
AUTHOR
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 June 10 00:22 EDT 2024. Contains 373251 sequences. (Running on oeis4.)