A333197 Nonprime numbers k such that each nonprime divisor of k is 1 away from a prime number.
1, 4, 6, 8, 10, 12, 14, 16, 20, 22, 24, 28, 32, 38, 40, 44, 46, 48, 58, 62, 74, 80, 82, 88, 96, 106, 148, 158, 164, 166, 178, 194, 212, 226, 262, 278, 314, 316, 332, 346, 358, 382, 388, 398, 422, 458, 466, 478, 502, 524, 542, 556, 562, 586, 614, 632, 662, 674
Offset: 1
Keywords
Examples
48 is in the sequence because the nonprime divisors of 48 are {1, 4, 6, 8, 12, 16, 24, 48} and: |1 - 2| = 1, |4 - 5| = 1 (or |4 - 3| = 1), |6 - 7| = 1 (or |6 - 5| = 1), |8 - 7| = 1, |12 - 13| = 1 (or |12 - 11| = 1), |16 - 17| = 1, |24 - 23| = 1, |48 - 47| = 1.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
with(numtheory): for n from 1 to 50 do: if type(n,prime)=false then d:=divisors(n):n0:=nops(d):it:=0: for k from 1 to n0 do : if nextprime(d[k])- d[k]= 1 or d[k] - prevprime(d[k])= 1 or isprime(d[k]) then it:=it+1: eles fi: od: if it=n0 then printf(`%d, `,n): else fi: fi: od: # Alternative: N:= 1000: # for terms <= N P,NP:= selectremove(isprime, [$1..N]): P:= convert(P,set): P1:= P union map(`+`,P,1) union map(`-`,P,1): filter:= proc(n) numtheory:-divisors(n) subset P1 end proc: select(filter, NP); # Robert Israel, Apr 12 2020
-
Mathematica
seqQ[n_] := !PrimeQ[n] && AllTrue[Divisors[n], AnyTrue[# + {-1,0,1}, PrimeQ] &]; Select[Range[700], seqQ] (* Amiram Eldar, Mar 11 2020 *)
-
PARI
isok(m) = !isprime(m) && (sumdiv(m, d, !isprime(d) && (isprime(d+1) || ((d>1) && isprime(d-1)))) == sumdiv(m, d, !isprime(d))); \\ Michel Marcus, Mar 11 2020
Comments