D-Number

Author

Eric W. Weisstein
February 17, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheory/D-Number.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/D-Number.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Code

KnoedelQ[n_Integer,k_]:=False/;PrimeQ[n]
KnoedelQ[n_Integer,k_]:=False /;n≤k
KnoedelQ[n_Integer,k_]:=Module[{a=2},
While[a<n&&(GCD[a,n]≠1||Mod[a^(n-k)-1,n]==0),a++];
a==n
]

Enumeration

Select[Range[100],KnoedelQ[#,3]&]