login
a(p) = a(n) + 1 if p is the n-th prime, prime(n); a(n)=0 if n is not prime.
28

%I #63 Jul 18 2024 14:26:34

%S 0,1,2,0,3,0,1,0,0,0,4,0,1,0,0,0,2,0,1,0,0,0,1,0,0,0,0,0,1,0,5,0,0,0,

%T 0,0,1,0,0,0,2,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,3,0,1,0,0,0,0,0,2,0,

%U 0,0,1,0,1,0,0,0,0,0,1,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0

%N a(p) = a(n) + 1 if p is the n-th prime, prime(n); a(n)=0 if n is not prime.

%C Fernandez calls this the order of primeness of n.

%C a(A007097(n))=n, for any n >= 0. - _Paul Tek_, Nov 12 2013

%C When a nonoriented rooted tree is encoded as a Matula-Goebel number n, a(n) tells how many edges needs to be climbed up from the root of the tree until the first branching vertex (or the top of the tree, if n is one of the terms of A007097) is encountered. Please see illustrations at A061773. - _Antti Karttunen_, Jan 27 2014

%C Zero-based column index of n in the Kimberling-style dispersion table of the primes (see A114537). - _Allan C. Wechsler_, Jan 09 2024

%H Reinhard Zumkeller, <a href="/A078442/b078442.txt">Table of n, a(n) for n = 1..10000</a>

%H N. Fernandez, <a href="http://www.borve.org/primeness/FOP.html">An order of primeness, F(p)</a>

%H N. Fernandez, <a href="/A006450/a006450.html">An order of primeness</a> [cached copy, included with permission of the author]

%H <a href="/index/Mat#matula">Index entries for sequences related to Matula-Goebel numbers</a>

%F a(n) = A049076(n)-1.

%F a(n) = if A049084(n) = 0 then 0 else a(A049084(n)) + 1. - _Reinhard Zumkeller_, Jul 14 2013

%F For all n, a(n) = A007814(A135141(n)) and a(A227413(n)) = A007814(n). Also a(A235489(n)) = a(n). - _Antti Karttunen_, Jan 27 2014

%e a(1) = 0 since 1 is not prime;

%e a(2) = a(prime(1)) = a(1) + 1 = 1 + 0 = 1;

%e a(3) = a(prime(2)) = a(2) + 1 = 1 + 1 = 2;

%e a(4) = 0 since 4 is not prime;

%e a(5) = a(prime(3)) = a(3) + 1 = 2 + 1 = 3;

%e a(6) = 0 since 6 is not prime;

%e a(7) = a(prime(4)) = a(4) + 1 = 0 + 1 = 1.

%p A078442 := proc(n)

%p if not isprime(n) then

%p 0 ;

%p else

%p 1+procname(numtheory[pi](n)) ;

%p end if;

%p end proc: # _R. J. Mathar_, Jul 07 2012

%t a[n_] := a[n] = If[!PrimeQ[n], 0, 1+a[PrimePi[n]]]; Array[a, 105] (* _Jean-François Alcover_, Jan 26 2018 *)

%o (PARI) A078442(n)=for(i=0,n, isprime(n) || return(i); n=primepi(n)) \\ _M. F. Hasler_, Mar 09 2010

%o (Haskell)

%o a078442 n = fst $ until ((== 0) . snd)

%o (\(i, p) -> (i + 1, a049084 p)) (-2, a000040 n)

%o -- _Reinhard Zumkeller_, Jul 14 2013

%Y A left inverse of A007097.

%Y One less than A049076.

%Y a(A000040(n)) = A049076(n).

%Y Cf. A373338 (mod 2), A018252 (positions of zeros).

%Y Cf. A000720, A049084, A061773.

%Y Cf. permutations A235489, A250247/A250248, A250249/A250250, A245821/A245822 that all preserve a(n).

%Y Cf. also array A114537 (A138947) and permutations A135141/A227413, A246681.

%K nonn

%O 1,3

%A _Henry Bottomley_, Dec 31 2002