login
a(n) is the smallest composite squarefree number k such that (p+n) | (k+1) for all primes dividing k.
3

%I #17 Jul 05 2016 08:30:48

%S 399,299,55,611,143,5549,39,155,493,615383,713,3247,119,1304489,1333,

%T 31415,2599,749,2183,440153,155,75499,119,168600949,4223,223649,559,

%U 66299,6407,15157,3431,85499,799,31589,7313

%N a(n) is the smallest composite squarefree number k such that (p+n) | (k+1) for all primes dividing k.

%e Prime factors of 399 are 3, 7 and 19. (399 + 1) / (3 + 1) = 400 / 4 = 100, (399 + 1) / (7 + 1) = 400 / 8 = 50 and (399 + 1) / (19 + 1) = 400 / 20 = 20.

%e Prime factors of 299 are 13 and 23. (399 + 1) / (13 + 2) = 300 / 15 = 20 and (399 + 1) / (23 + 2) = 300 / 25 = 12.

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

%p for k from 1 to q do for n from 2 to q do

%p if not isprime(n) and issqrfree(n) then p:=ifactors(n)[2]; ok:=1;

%p for d from 1 to nops(p) do

%p if not type((n+1)/(p[d][1]+k),integer) then ok:=0; break; fi; od;

%p if ok=1 then print(n); break; fi; fi; od; od; end: P(10^9);

%t t = Select[Range[2000000], SquareFreeQ@ # && CompositeQ@ # &]; Table[SelectFirst[t, Function[k, AllTrue[First /@ FactorInteger@ k, Divisible[k + 1, # + n] &]]], {n, 23}] (* _Michael De Vlieger_, Jun 24 2016, Version 10 *)

%o (PARI) isok(k,n) = {if (! issquarefree(k), return (0)); vp = factor(k) [,1]; if (#vp == 1, return (0)); for (i=1, #vp, if ((k+1) % (n+vp[i]), return (0));); 1;}

%o a(n) = {my(k=2); while (! isok(k,n), k++); k;} \\ _Michel Marcus_, Jun 28 2016

%Y Cf. A208728, A225702-A225720, A226020, A226111-A226114, A226364, A226448, A228299-A228302, A229273-A229276, A229321-A229324, A274443, A274444, A274445.

%K nonn,easy

%O 1,1

%A _Paolo P. Lava_, Jun 23 2016

%E a(24) from _Giovanni Resta_, Jun 23 2016