login
Composite numbers n equal to the sum of prime factors, counted with multiplicity, of the numbers in the interval [n-k,n+k], for some k.
5

%I #31 May 28 2015 06:10:36

%S 4,75,186,531,627,5216,22843,148050,1061385,1490407,1562485,9034704,

%T 10422738,31920786,76343543,78824242,105791155,111873121,131515163,

%U 549038887,1318856915,1394579379,1630428366,1639063828,3710476544,3996221763,4524478925,6172721935

%N Composite numbers n equal to the sum of prime factors, counted with multiplicity, of the numbers in the interval [n-k,n+k], for some k.

%C Prime numbers are not considered because they are a trivial solution being the sum of their single prime factor (case k = 0).

%C Composite n such that n = Sum_{i=-k..k} A001414(i+n) for some k.

%C Values of k are 0, 1, 2, 4, 3, 4, 7, 6, 6, 8, 8, 9, 12, 8, 17, 9, 11, 4, 18, 11, ...

%H Giovanni Resta, <a href="/A257367/b257367.txt">Table of n, a(n) for n = 1..40</a> (terms < 3*10^11)

%e Prime factors of 4 are 2, 2 and 2 + 2 = 4. In this case k = 0.

%e For 75, k is equal to 1. Let us consider the prime factors of 74, 75 and 76. They are: 2, 37; 3, 5, 5; 2, 2, 19. Their sum is 2 + 37 + 3 + 5 + 5 + 2 + 2 + 19 = 75.

%e For 186, k is equal to 2. Let us consider the prime factors of 184, 185, 186, 187, 188. They are: 2, 2, 2, 23; 5, 37; 2, 3, 31; 11, 17; 2, 2, 47. Their sum is 2 + 2 + 2 + 23 + 5 + 37 + 2 + 3 + 31 + 11 + 17 + 2 + 2 + 47 = 186.

%p with(numtheory); P:= proc(q) local a,c,d,j,k,n;

%p for n from 2 to q do if not isprime(n) then a:=ifactors(n)[2];

%p k:=0; a:=add(a[j][1]*a[j][2],j=1..nops(a));

%p while a<n do k:=k+1; c:=ifactors(n-k)[2]; d:=ifactors(n+k)[2];

%p c:=add(c[j][1]*c[j][2],j=1..nops(c));

%p d:=add(d[j][1]*d[j][2],j=1..nops(d));

%p a:=a+c+d; od; if a=n then print(n); fi; fi; od; end: P(10^9);

%o (PARI) sopfr(n) = my(f=factor(n)); sum(k=1, #f~, f[k, 1]*f[k, 2]);

%o isok(n) = {my(s = sopfr(n)); my(k = 1); while (s < n, s += sopfr(n-k) + sopfr(n+k); k++); s == n;}

%o lista(nn) = {forcomposite(n=2, nn, if (isok(n), print1(n, ", ")););} \\ _Michel Marcus_, May 27 2015

%Y Cf. A001414, A257524, A257525.

%K nonn

%O 1,1

%A _Paolo P. Lava_, Apr 21 2015

%E a(21)-a(28) from _Giovanni Resta_, May 27 2015