OFFSET
1,6
COMMENTS
Let N = 2n-1. Then consider the following algorithm of updating pairs (v,m) indicating highest exponent of 2 (2-adic valuation) and odd part: Initialize at step 1 by v(1) = A007814(N+1) and m(1) = A000265(N+1). Iterate over steps i>=2: v(i) = A007814(N+m(i-1)), m(i) = A000265(N+m(i-1)) using the previous odd part m(i-1) until some m(k) = 1. a(n) is defined as the count of the v(i) which are larger than 1.
This is an algorithm to compute A002326 because the sum v(1)+v(2)+ ... +v(k) of the exponents is A002326(n-1).
A179382(n) = 1 + the number of iterations taken by the algorithm when starting from N = 2n-1. - Antti Karttunen, Oct 02 2017
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..8192
EXAMPLE
For n = 9, 2*n-1 = 17, we have v_1 = v_2 = v_3 = 1, v_4 = 5. Thus a(9) = 1.
For n = 10, 2*n-1 = 19, we have v_1 = 2, v_2 = 3, v_3 = v_4 = v_5 = 1, v_6 = v_7 = 2, v_8 = 1, v_9 = 5. Thus a(10) = 5.
MAPLE
MATHEMATICA
a7814[n_] := IntegerExponent[n, 2];
a265[n_] := n/2^IntegerExponent[n, 2];
a[n_] := Module[{l, m, k, nn}, nn = 2n-1; k = 0; l = a7814[nn+1]; m = a265[nn+1]; If[l>1, k++]; While[m != 1, l = a7814[nn+m]; If[l>1, k++]; m = a265[nn+m]]; k];
Array[a, 80] (* Jean-François Alcover, Jul 30 2018, after R. J. Mathar *)
PROG
(Scheme) (define (A179680 n) (let ((x (+ n n -1))) (let loop ((s (- 1 (A000035 n))) (k 1)) (let ((m (A000265 (+ x k)))) (if (= 1 m) s (loop (+ s (if (> (A007814 (+ x m)) 1) 1 0)) m)))))) ;; Antti Karttunen, Oct 02 2017
(Sage)
def A179680(n):
s, m, N = 0, 1, 2*n - 1
while True:
k = N + m
v = valuation(k, 2)
if v > 1: s += 1
m = k >> v
if m == 1: break
return s
print([A179680(n) for n in (1..80)]) # Peter Luschny, Oct 07 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Jul 24 2010
STATUS
approved