Hilbert Number

Author

Eric W. Weisstein
September 1, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/IntegerSequences/HilbertNumbers.nb.

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

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

Code

HilbertNumberQ[n_Integer?Positive]:=Mod[n,4]==1
HilbertPrimeQ[n_Integer?Positive]:=HilbertNumberQ[n]&&Select[Drop[Rest[Divisors[n]],-1],HilbertNumberQ]=={}

Hilbert Numbers

Table[4k+1,{k,0,10}]

Hilbert Primes

primes=Select[Table[4k+1,{k,25}],HilbertPrimeQ]

Factorization

Efficient

HilbertFactorizations[n_Integer]:=Module[{d=Divisors[n]},
Select[{#,n/#}&/@Take[d,{2,Ceiling[Length[d]/2]}],HilbertPrimeQ/@And@@#&]
]

{Times@@First[#],#}&/@Select[HilbertFactorizations/@Range[5000],Length[#]>1&]//ColumnForm

Inefficient

<<DiscreteMath`Combinatorica`

{#[[1,1]],Last/@#}&/@Select[Split[Sort[{Times@@#,#}&/@KSubsets[primes,2]],First[#1]==First[#2]&],
Length[#]>1&]//ColumnForm

primes=Select[Table[4k+1,{k,25}],HilbertPrimeQ]

Take[{#[[1,1]],Last/@#}&/@Select[Split[Sort[{Times@@#,#}&/@Rest[Subsets[primes]]],First[#1]==First[#2]&],
Length[#]>1&],15]//ColumnForm

Hilbert Composites

Select[Table[4k+1,{k,100}],!HilbertPrimeQ[#]&]