cp's OEIS Frontend

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.

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)).

This page as a plain text file.
%I A196526 #29 Mar 12 2022 14:08:11
%S A196526 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 A196526 11,12,10,10,11,11,16,18,18,18,17,18,18,17,16,15,16,17,15,18,18,18,18,
%U A196526 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 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)).
%C A196526 All terms are positive integers, no zero term.
%C A196526 The Mathematica program generates first 99 items and the function AllSplits[n_] can be used to generate a(n) for any n > 1.
%H A196526 Reinhard Zumkeller, <a href="/A196526/b196526.txt">Table of n, a(n) for n = 2..1000</a>
%e A196526 n=2: prime(2)=3 = 2 + 1 = 2^2 - 1, so a(2)=2;
%e A196526 n=3: prime(3)=5 = 2^2 + 1, so a(3)=1;
%e A196526 ...
%e A196526 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 A196526 AllPrimes[k_] :=
%t A196526 Module[{p, maxfactor, pset}, p = Prime[k];
%t A196526   maxfactor = NextPrime[IntegerPart[Sqrt[p]] + 1, -1];
%t A196526   If[maxfactor == -2, pset = {2}, p0 = 2; pset = {2};
%t A196526    While[p0 = NextPrime[p0]; p0 <= maxfactor,
%t A196526     pset = Union[pset, {p0}]]]; pset];
%t A196526 NextIntegerWithFactor[seed_, fset_] :=
%t A196526 Module[{m, a, l, i, fset1}, m = seed - 1;
%t A196526   While[m++; If[Mod[m, 2] == 1, m++]; a = FactorInteger[m];
%t A196526    l = Length[a]; fset1 = {};
%t A196526    Do[fset1 = Union[fset1, {a[[i]][[1]]}], {i, 1, l}];
%t A196526    Intersection[fset1, fset] != fset1]; m];
%t A196526 FactorSet[seed_] :=
%t A196526 Module[{fset2, a, l, i}, a = FactorInteger[seed]; l = Length[a];
%t A196526   fset2 = {}; Do[fset2 = Union[fset2, {a[[i]][[1]]}], {i, 1, l}];
%t A196526   fset2]; SplitPrime[n_, q0_] :=
%t A196526 Module[{p, pset, q, r, rp, fs, rs, qs}, p = Prime[n];
%t A196526   pset = AllPrimes[n]; q = q0;
%t A196526   While[q++; q = NextIntegerWithFactor[q, pset]; r = p - q;
%t A196526    rp = Abs[r]; fs = FactorSet[rp];
%t A196526    rs = Complement[pset, FactorSet[q]];
%t A196526    qs = Intersection[fs,
%t A196526      rs]; (fs != {1}) && (fs != qs) && (q <= (p + 1))]; {p, q, r} ];
%t A196526 AllSplits[n_] :=
%t A196526 Module[{q, ss, spls}, q = 0; spls = {};
%t A196526   While[ss = SplitPrime[n, q]; q = ss[[2]];
%t A196526    If[q <= (Prime[n] + 1), spls = Union[spls, {ss}]];
%t A196526    q < (Prime[n] + 1)]; spls]; Table[
%t A196526 Length[AllSplits[i]], {i, 2, 100}] (* _Lei Zhou_ *)
%t A196526 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 A196526 (Haskell)
%o A196526 a196526 n = length [c | let p = a000040 n,
%o A196526                         c <- [-1,1..p-1], let b = p - c,
%o A196526                         gcd b c == 1,
%o A196526                         a006530 b ^ 2 < p || p == 3, a006530 c ^ 2 < p]
%o A196526 -- _Reinhard Zumkeller_, Oct 04 2001
%Y A196526 Cf. A006530 (largest prime factor), A000040.
%K A196526 nonn,easy
%O A196526 2,1
%A A196526 _Lei Zhou_, Oct 03 2011