login
Semiprimes where the sum of the digits equals the difference between the prime factors.
1

%I #25 Sep 08 2022 08:46:21

%S 14,95,527,851,1247,3551,4307,8051,14351,26969,30227,37769,64769,

%T 87953,152051,163769,199553,202451,256793,275369,341969,455369,

%U 1070969,1095953,1159673,1232051,1625369,1702769,2005007,2081993

%N Semiprimes where the sum of the digits equals the difference between the prime factors.

%C 14 is the only even number in the sequence, since 2 is the only even prime and p-2 grows much faster than the digit sum of 2p.

%H James Beyer, <a href="/A308821/b308821.txt">Table of n, a(n) for n = 1..1000</a>

%H James Beyer, <a href="https://jebeyer.github.io/nlfourteen.html">Numbers Like Fourteen</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Digit_sum">Digit sum</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Semiprime">Semiprime</a>

%e 14=2*7 and 1+4=7-2.

%e 95=5*19 and 9+5=19-5.

%e 527=17*31 and 5+2+7=31-17.

%t 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 *)

%t 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 *)

%o (PARI) isok(n) = (bigomega(n) == 2) && (f=factor(n)) && (#f~ == 2) && (sumdigits(n) == f[2,1] - f[1,1]); \\ _Michel Marcus_, Jun 29 2019

%o (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

%Y Cf. A001358, A006753, A006881.

%K nonn,base

%O 1,1

%A _James Beyer_, Jun 26 2019