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!)
A196526 a(n) is the number of ways the n-th prime number prime(n) can be written as sum of coprime b and c, in which b is a positive even number and c is an odd number that is -1 or greater, and all odd prime factors of b and c are less than or equal to sqrt(prime(n)). 4

%I #29 Mar 12 2022 14:08:11

%S 2,1,1,3,2,3,2,1,5,5,4,4,3,4,8,8,7,7,7,7,8,7,8,7,6,6,7,7,7,12,13,12,

%T 11,12,10,10,11,11,16,18,18,18,17,18,18,17,16,15,16,17,15,18,18,18,18,

%U 17,16,18,17,16,24,24,23,23,23,23,24,23,24,24,25,32,33,34,33,36,34,35,33,35,33,32,35,34,33,33,34,33,35,34,31,32,30,35,35,34,32,32,45

%N a(n) is the number of ways the n-th prime number prime(n) can be written as sum of coprime b and c, in which b is a positive even number and c is an odd number that is -1 or greater, and all odd prime factors of b and c are less than or equal to sqrt(prime(n)).

%C All terms are positive integers, no zero term.

%C The Mathematica program generates first 99 items and the function AllSplits[n_] can be used to generate a(n) for any n > 1.

%H Reinhard Zumkeller, <a href="/A196526/b196526.txt">Table of n, a(n) for n = 2..1000</a>

%e n=2: prime(2)=3 = 2 + 1 = 2^2 - 1, so a(2)=2;

%e n=3: prime(3)=5 = 2^2 + 1, so a(3)=1;

%e ...

%e n=10: prime(10)=29, int(sqrt(29))=5, 29 = 2+3^3 = 2^2+5^2 = 2^2*5+3^2 = 2^3*3+5 = 2*3*5-1, so a(10)=5.

%t AllPrimes[k_] :=

%t Module[{p, maxfactor, pset}, p = Prime[k];

%t maxfactor = NextPrime[IntegerPart[Sqrt[p]] + 1, -1];

%t If[maxfactor == -2, pset = {2}, p0 = 2; pset = {2};

%t While[p0 = NextPrime[p0]; p0 <= maxfactor,

%t pset = Union[pset, {p0}]]]; pset];

%t NextIntegerWithFactor[seed_, fset_] :=

%t Module[{m, a, l, i, fset1}, m = seed - 1;

%t While[m++; If[Mod[m, 2] == 1, m++]; a = FactorInteger[m];

%t l = Length[a]; fset1 = {};

%t Do[fset1 = Union[fset1, {a[[i]][[1]]}], {i, 1, l}];

%t Intersection[fset1, fset] != fset1]; m];

%t FactorSet[seed_] :=

%t Module[{fset2, a, l, i}, a = FactorInteger[seed]; l = Length[a];

%t fset2 = {}; Do[fset2 = Union[fset2, {a[[i]][[1]]}], {i, 1, l}];

%t fset2]; SplitPrime[n_, q0_] :=

%t Module[{p, pset, q, r, rp, fs, rs, qs}, p = Prime[n];

%t pset = AllPrimes[n]; q = q0;

%t While[q++; q = NextIntegerWithFactor[q, pset]; r = p - q;

%t rp = Abs[r]; fs = FactorSet[rp];

%t rs = Complement[pset, FactorSet[q]];

%t qs = Intersection[fs,

%t rs]; (fs != {1}) && (fs != qs) && (q <= (p + 1))]; {p, q, r} ];

%t AllSplits[n_] :=

%t Module[{q, ss, spls}, q = 0; spls = {};

%t While[ss = SplitPrime[n, q]; q = ss[[2]];

%t If[q <= (Prime[n] + 1), spls = Union[spls, {ss}]];

%t q < (Prime[n] + 1)]; spls]; Table[

%t Length[AllSplits[i]], {i, 2, 100}] (* _Lei Zhou_ *)

%t zhouAbleCount[n_] := Length[Select[Range[-1, Prime[n], 2], GCD[#, Prime[n] - #] == 1 && FactorInteger[#][[-1, 1]] <= Sqrt[Prime[n]] && (IntegerQ[Log[2, Prime[n] - #]] || FactorInteger[Prime[n] - #][[-1, 1]] <= Sqrt[Prime[n]]) &]]; Table[zhouAbleCount[n], {n, 2, 100}] (* _Alonso del Arte_, Oct 03 2011 *)

%o (Haskell)

%o a196526 n = length [c | let p = a000040 n,

%o c <- [-1,1..p-1], let b = p - c,

%o gcd b c == 1,

%o a006530 b ^ 2 < p || p == 3, a006530 c ^ 2 < p]

%o -- _Reinhard Zumkeller_, Oct 04 2001

%Y Cf. A006530 (largest prime factor), A000040.

%K nonn,easy

%O 2,1

%A _Lei Zhou_, Oct 03 2011

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 April 25 11:39 EDT 2024. Contains 371969 sequences. (Running on oeis4.)