OFFSET
1,4
COMMENTS
There are three equivalent formulas for a(n). Suppose n >= 2, and let p1 <= p2 <= ... <= pk be the prime factors of n, with repetition.
Theorem 1: a(1) = 0. For n >= 2, a(n) = n*s(n), where
s(n) = 1/p1 + 1/(p1*p2) + 1/(p1*p2*p3) + ... + 1/(p1*p2*...*pk).
This is implicit in Berlekamp, Conway and Guy, Winning Ways, 2 vols., 1982, pp. 28, 53.
David James Sycamore observed on Nov 24 2018 that Theorem 1 implies a(n) < n for all n (see comments in A322034), and also leads to a simple recurrence for a(n):
Theorem 2: a(1) = 0. For n >= 2, a(n) = p*a(n/p) + 1, where p is the largest prime factor of n.
Proof. (Th. 1 implies Th. 2) If n is a prime, Theorem 1 gives a(n) = 1 = n*a(1)+1. For a nonprime n, let n = m*p where p is the largest prime factor of n and m >= 2. From Theorem 1, a(m) = m*s(m), a(n) = q*m*(s(m) + 1/n) = q*a(m) + 1.
(Th. 2 implies Th. 1) The reverse implication is equally easy.
Theorem 2 is equivalent to the following more complicated recurrence:
Theorem 3: a(1) = 0. For n >= 2, a(n) = max_{p|n, p prime} (p*a(n/p)+1).
REFERENCES
E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 28, 53.
E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Second Edition, Vol. 1, A K Peters, 2001, pp. 27, 51.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Jonathan Blanchette and Robert Laganière, A Curious Link Between Prime Numbers, the Maundy Cake Problem and Parallel Sorting, arXiv:1910.11749 [cs.DS], 2019.
FORMULA
a(n) = n * Sum_{k=1..N} (1/(p1^m1*p2^m2*...*pk^mk)) * (pk^mk-1)/(pk-1) for n>=2, where pk is the k-th distinct prime factor of n, N is the number of distinct prime factors of n, and mk is the multiplicity of pk occurring in n. To prove this, expand the factors in Theorem 1 and use the geometrical series identity. - Jonathan Blanchette, Nov 01 2019
From Antti Karttunen, Apr 12 2020: (Start)
a(n) = Sum_{k=1..bigomega(n)} F^k(n), where F^k(n) is the k-th iterate of F(n) = A032742(n). - Ridouane Oudra, Jan 26 2024
EXAMPLE
For n=24, s(24) = 1/2 + 1/4 + 1/8 + 1/24 = 11/12, so a(24) = 24*11/12 = 22.
MAPLE
P:=proc(n) local FM: FM:=ifactors(n)[2]: seq(seq(FM[j][1], k=1..FM[j][2]), j=1..nops(FM)) end: # A027746
s:=proc(n) local i, t, b; global P; t:=0; b:=1; for i in [P(n)] do b:=b*i; t:=t+1/b; od; t; end; # A322034/A322035
A006022 := n -> if n = 1 then 0 else n*s(n); fi;
# N. J. A. Sloane, Nov 28 2018
MATHEMATICA
Nest[Function[{a, n}, Append[a, Max@ Map[# a[[n/#]] + 1 &, Rest@ Divisors@ n]]] @@ {#, Length@ # + 1} &, {0, 1}, 77] (* Michael De Vlieger, Nov 23 2018 *)
PROG
(Haskell)
a006022 1 = 0
a006022 n = (+ 1) $ sum $ takeWhile (> 1) $
iterate (\x -> x `div` a020639 x) (a032742 n)
-- Reinhard Zumkeller, Jun 03 2012
(PARI) lista(nn) = {my(v = vector(nn)); for (n=1, nn, if (n>1, my(m = 0); fordiv (n, d, if (d>1, m = max(m, d*v[n/d]+1))); v[n] = m; ); print1(v[n], ", "); ); } \\ Michel Marcus, Nov 25 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Edited and extended by Christian G. Bower, Oct 18 2002
Entry revised by N. J. A. Sloane, Nov 28 2018
STATUS
approved