

A323375


Let f(p, q) denote the pair (p + q, wt(p) + wt(q)). a(n) gives the number of iterations of f starting at (n, 1) needed to make p/q an integer, or if no integer is ever reached then a(n) = 1. (Here wt is binary weight, A000120.)


3



1, 3, 3, 3, 1, 2, 1, 11, 4, 10, 1, 3, 4, 9, 2, 19, 1, 18, 1, 1, 7, 17, 7, 7, 6, 5, 6, 6, 1, 4, 15, 5, 16, 4, 1, 2, 4, 3, 1, 14, 3, 13, 13, 13, 12, 12, 1, 6, 12, 2, 5, 5, 11, 1, 5, 13, 10, 4, 1, 12, 3, 9, 3, 3, 1, 2, 1, 1, 40, 2, 8, 8, 39, 3, 7, 7, 9, 2, 3, 1, 3, 37, 37, 37, 5, 36, 36, 3, 1, 8
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


LINKS

Table of n, a(n) for n=1..90.


EXAMPLE

n=8; (8, 1) > (9, 2) > (11, 3) > (14, 5) > (19, 5) > (24, 5) > (29, 4) > (33, 5) > (38, 4) > (42, 4) > 46, 4) > (50, 5). 50/5 = 10, so a(8) = 11 because it needs 11 iterations until p/q is an integer.


PROG

(PARI) f(v) = return([v[1]+v[2], hammingweight(v[1])+hammingweight(v[2])]);
a(n) = {my(nb = 0, v = [n, 1]); while (1, v = f(v); nb++; if (frac(v[1]/v[2]) == 0, return (nb))); } \\ Michel Marcus, Jan 13 2019


CROSSREFS

Cf. A323275, A000120.
Sequence in context: A119560 A172364 A323596 * A140366 A167817 A153401
Adjacent sequences: A323372 A323373 A323374 * A323376 A323377 A323378


KEYWORD

nonn,base


AUTHOR

Ctibor O. Zizka, Jan 12 2019


STATUS

approved



