A308821 Semiprimes where the sum of the digits equals the difference between the prime factors.
14, 95, 527, 851, 1247, 3551, 4307, 8051, 14351, 26969, 30227, 37769, 64769, 87953, 152051, 163769, 199553, 202451, 256793, 275369, 341969, 455369, 1070969, 1095953, 1159673, 1232051, 1625369, 1702769, 2005007, 2081993
Offset: 1
Examples
14=2*7 and 1+4=7-2. 95=5*19 and 9+5=19-5. 527=17*31 and 5+2+7=31-17.
Links
- James Beyer, Table of n, a(n) for n = 1..1000
- James Beyer, Numbers Like Fourteen
- Wikipedia, Digit sum
- Wikipedia, Semiprime
Programs
-
Magma
[n:n in [2..2100000]|IsSquarefree(n) and #PrimeDivisors(n) eq 2 and PrimeDivisors(n)[2]-PrimeDivisors(n)[1] eq &+Intseq(n)]; // Marius A. Burtea, Jul 27 2019
-
Mathematica
Take[Sort@ Reap[ Do[ If[PrimeQ[q + g] && g == Total@ IntegerDigits[n = q (q + g)], Sow@n], {g, 9*9}, {q, Prime@ Range@ 2000}]][[2, 1]], 100] (* Giovanni Resta, Jul 25 2019 *) spdpfQ[n_]:=Module[{f=FactorInteger[n][[All,1]]},PrimeOmega[n]== 2 && Total[ IntegerDigits[n]]==f[[2]]-f[[1]]]; Select[Range[ 21*10^5],spdpfQ]// Quiet (* or *) Times@@@Select[Subsets[Prime[ Range[ 300]],{2}],#[[2]]-#[[1]]==Total[IntegerDigits[#[[1]]#[[2]]]]&] (* Harvey P. Dale, Oct 14 2021 *)
-
PARI
isok(n) = (bigomega(n) == 2) && (f=factor(n)) && (#f~ == 2) && (sumdigits(n) == f[2,1] - f[1,1]); \\ Michel Marcus, Jun 29 2019
Comments