A064097 A quasi-logarithm defined inductively by a(1) = 0 and a(p) = 1 + a(p-1) if p is prime and a(n*m) = a(n) + a(m) if m,n > 1.
0, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5, 5, 5, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 6, 6, 7, 6, 7, 5, 7, 6, 7, 6, 7, 7, 7, 6, 7, 7, 8, 7, 7, 8, 9, 6, 8, 7, 7, 7, 8, 7, 8, 7, 8, 8, 9, 7, 8, 8, 8, 6, 8, 8, 9, 7, 9, 8, 9, 7, 8, 8, 8, 8, 9, 8, 9, 7, 8, 8, 9, 8, 8, 9, 9, 8, 9, 8, 9, 9, 9, 10, 9, 7, 8, 9, 9, 8, 9, 8, 9, 8
Offset: 1
Keywords
Examples
a(19) = 6: 19 - 1 = 18; 18 - 9 = 9; 9 - 3 = 6; 6 - 3 = 3; 3 - 1 = 2; 2 - 1 = 1. That is a total of 6 iterations. - _Jaroslav Krizek_, Jan 28 2010 From _Antti Karttunen_, Apr 04 2020: (Start) We can follow also alternative routes, where we do not always select the largest proper divisor to subtract, for example, from 19 to 1, we could go as: 19-1 = 18; 18-(18/3) = 12; 12-(12/2) = 6; 6-(6/3) = 4; 4-(4/2) = 2; 2-(2/2) = 1, or as 19-1 = 18; 18-(18/3) = 12; 12-(12/3) = 8; 8-(8/2) = 4; 4-(4/2) = 2; 2-(2/2) = 1, both of which also have exactly 6 iterations. (End)
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- Passawan Noppakaew and Prapanpong Pongsriiam, Product of Some Polynomials and Arithmetic Functions, J. Int. Seq. (2023) Vol. 26, Art. 23.9.1.
- Hugo Pfoertner, Addition chains
- Mathematics Stack Exchange, Does a graded poset on the positive integers generated from subtracting factors define a lattice?
- Wikipedia, Addition chain
Crossrefs
Similar to A061373 which uses the same recurrence relation but a(1) = 1.
Cf. A003313, A005245, A020639, A032742, A052126, A054725, A060681, A064415, A073933, A076142, A076091, A175125, A256653, A307742, A323076, A323077, A329697, A333123, A334200, A334202, A334203, and array A334111.
Cf. A000079 (position of last occurrence), A105017 (position of records), A334197 (positions of record jumps upward).
Partial sums of A334090.
Cf. also A056239.
Programs
-
Haskell
import Data.List (genericIndex) a064097 n = genericIndex a064097_list (n-1) a064097_list = 0 : f 2 where f x | x == spf = 1 + a064097 (spf - 1) : f (x + 1) | otherwise = a064097 spf + a064097 (x `div` spf) : f (x + 1) where spf = a020639 x -- Reinhard Zumkeller, Mar 08 2013
-
Maple
a:= proc(n) option remember; add((1+a(i[1]-1))*i[2], i=ifactors(n)[2]) end: seq(a(n), n=1..120); # Alois P. Heinz, Apr 26 2019 # alternative which can be even used outside this entry A064097 := proc(n) option remember ; add((1+procname(i[1]-1))*i[2], i=ifactors(n)[2]) ; end proc: seq(A064097(n),n=1..100) ; # R. J. Mathar, Aug 07 2022
-
Mathematica
quasiLog := (Length@NestWhileList[# - Divisors[#][[-2]] &, #, # > 1 &] - 1) &; quasiLog /@ Range[1024] (* Terentyev Oleg, Jul 17 2011 *) fi[n_] := Flatten[ Table[#[[1]], {#[[2]]}] & /@ FactorInteger@ n]; a[1] = 0; a[n_] := If[ PrimeQ@ n, a[n - 1] + 1, Plus @@ (a@# & /@ fi@ n)]; Array[a, 105] (* Robert G. Wilson v, Jul 17 2013 *) a[n_] := Length@ NestWhileList[# - #/FactorInteger[#][[1, 1]] &, n, # != 1 &] - 1; Array[a, 100] (* or *) a[n_] := a[n - n/FactorInteger[n][[1, 1]]] +1; a[1] = 0; Array[a, 100] (* Robert G. Wilson v, Mar 03 2020 *)
-
PARI
NN=200; an=vector(NN); a(n)=an[n]; for(n=2,NN,an[n]=if(isprime(n),1+a(n-1), sumdiv(n,p, if(isprime(p),a(p)*valuation(n,p))))); for(n=1,100,print1(a(n)", "))
-
PARI
a(n)=if(isprime(n), return(a(n-1)+1)); if(n==1, return(0)); my(f=factor(n)); apply(a,f[,1])~ * f[,2] \\ Charles R Greathouse IV, May 10 2016
-
Scheme
(define (A064097 n) (if (= 1 n) 0 (+ 1 (A064097 (A060681 n))))) ;; After Jaroslav Krizek's Jan 28 2010 formula. (define (A060681 n) (- n (A032742 n))) ;; See also code under A032742. ;; Antti Karttunen, Aug 23 2017
Formula
Conjectures: for n>1, log(n) < a(n) < (5/2)*log(n); lim n ->infinity sum(k=1, n, a(k))/(n*log(n)-n) = C = 1.8(4)... - Benoit Cloitre, Oct 30 2002
Conjecture: for n>1, floor(log_2(n)) <= a(n) < (5/2)*log(n). - Robert G. Wilson v, Aug 10 2013
a(n) = Sum_{k=1..n} a(p_k)*e_k if n is composite with factorization p_1^e_1 * ... * p_k^e_k. - Orson R. L. Peters, May 10 2016
From Antti Karttunen, Aug 23 2017: (Start)
a(1) = 0; for n > 1, a(n) = 1 + a(A060681(n)). [From Jaroslav Krizek's Jan 28 2010 formula in comments.]
a(n) = A073933(n) - 1. (End)
a(n) = A064415(n) + A329697(n) [= A054725(n) + A329697(n), for n > 1]. - Antti Karttunen, Apr 16 2020
Extensions
More terms from Michael Somos, Sep 25 2001
Comments