The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A238402 Number of ways to write n = p^2 + q - pi(q) with p prime and q among 1, ..., n, where pi(.) is given by A000720. 2

%I #12 Feb 26 2014 10:20:40

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

%T 2,2,1,1,2,1,1,1,1,2,2,1,1,1,1,5,3,3,3,3,3,3,3,2,3,3,2,3,3,2,2,2,3,4,

%U 3,2,2,2,3,3,2,3,4,3,2,2,3,3,2,2,3,3,2,2,2,3,3,3,2,2,2,2,4,2,2,3

%N Number of ways to write n = p^2 + q - pi(q) with p prime and q among 1, ..., n, where pi(.) is given by A000720.

%C For any positive integer q, clearly q + 1 - pi(q+1) - (q - pi(q)) = 1 + pi(q) - pi(q+1) is 0 or 1. Thus {q - pi(q): q = 1, ..., n} = {1, 2, ..., n-pi(n)}. Note that n - pi(n) > n/2 for n > 8. If p is at least sqrt(n/2), then n - p^2 <= n/2 and hence n - p^2 = q - pi(q) for some q = 1, ..., n. So it can be proved that a(n) > 0 for all n > 4. - Li-Lu Zhao and _Zhi-Wei Sun_, Feb 26 2014

%H Zhi-Wei Sun, <a href="/A238402/b238402.txt">Table of n, a(n) for n = 1..10000</a>

%e a(9) = 1 since 9 = 2^2 + 9 - pi(9) with 2 prime and pi(9) = 4.

%e a(40) = 1 since 40 = 5^2 + 24 - pi(24) with 5 prime and pi(24) = 9.

%e a(120) = 1 since 120 = 7^2 + 95 - pi(95) with 7 prime and pi(95) = 24.

%t SQ[n_]:=IntegerQ[Sqrt[n]]&&PrimeQ[Sqrt[n]]

%t a[n_]:=Sum[If[SQ[n-q+PrimePi[q]],1,0],{q,1,n}]

%t Table[a[n],{n,1,100}]

%Y Cf. A000040, A000290, A000720, A232443, A232463, A238386.

%K nonn

%O 1,5

%A _Zhi-Wei Sun_, Feb 26 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 11 13:44 EDT 2024. Contains 373311 sequences. (Running on oeis4.)