This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A095874 #34 Jan 19 2025 15:22:58 %S A095874 1,2,3,4,5,0,6,7,8,0,9,0,10,0,0,11,12,0,13,0,0,0,14,0,15,0,16,0,17,0, %T A095874 18,19,0,0,0,0,20,0,0,0,21,0,22,0,0,0,23,0,24,0,0,0,25,0,0,0,0,0,26,0, %U A095874 27,0,0,28,0,0,29,0,0,0,30,0,31,0,0,0,0,0,32,0,33,0,34,0,0,0,0,0,35,0 %N A095874 a(n) = k if n = A000961(k) (powers of primes), a(n) = 0 if n is not in A000961. %C A095874 The name has been edited to clarify that the indices k refer to A000961 ("powers of primes" = {1} U A246655) and not to the list A246655 of proper prime powers. - _M. F. Hasler_, Jun 16 2021 %H A095874 Reinhard Zumkeller, <a href="/A095874/b095874.txt">Table of n, a(n) for n = 1..10000</a> %F A095874 a(n) = Sum_{1 <= k <= n} A010055(k); [corrected by _M. F. Hasler_, Jun 15 2021] %F A095874 a(n) = A065515(n)*(A065515(n)-A065515(n-1)). %F A095874 a(n) = A065515(n)*A069513(n). - _M. F. Hasler_, Jun 16 2021 %t A095874 Join[{1},Module[{k=2},Table[If[PrimePowerQ[n],k;k++,0],{n,2,100}]]] (* _Harvey P. Dale_, Aug 15 2020 *) %o A095874 (Haskell) %o A095874 a095874 n | y == n = length xs + 1 %o A095874 | otherwise = 0 %o A095874 where (xs, y:ys) = span (< n) a000961_list %o A095874 -- _Reinhard Zumkeller_, Feb 16 2012, Jun 26 2011 %o A095874 (PARI) a(n)=if(isprimepower(n), sum(i=1,logint(n,2), primepi(sqrtnint(n,i)))+1, n==1) \\ _Charles R Greathouse IV_, Apr 29 2015 %o A095874 (PARI) {M95874=Map(); A095874(n,k)=if(mapisdefined(M95874,n,&k),k, isprimepower(n), mapput(M95874,n, k=sum(i=1,exponent(n), primepi(sqrtnint(n,i)))+1); k,n==1)} \\ Variant with memoization, possibly useful to compute A097621, A344826 and related. One may omit "isprimepower(n)," (possibly requiring factorization) and ",n==1" if n is known to be a power of a prime, i.e., to get a left inverse for A000961. - _M. F. Hasler_, Jun 15 2021 %o A095874 (Python) %o A095874 from sympy import primepi, integer_nthroot, primefactors %o A095874 def A095874(n): return 1+int(primepi(n)+sum(primepi(integer_nthroot(n,k)[0]) for k in range(2,n.bit_length()))) if n==1 or len(primefactors(n))==1 else 0 # _Chai Wah Wu_, Jan 19 2025 %Y A095874 Cf. A000961 (right inverse), A049084, A097621. %K A095874 nonn %O A095874 1,2 %A A095874 _Reinhard Zumkeller_, Jun 10 2004 %E A095874 Edited by _M. F. Hasler_, Jun 15 2021