Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Question

added 98 characters in body; edited tags
Source Link

A constructible n\$n\$-gon is a regular polygon with n sides that you can construct with only a compass and an unmarked ruler.

As stated by Gauss, the only n\$n\$ for which a n\$n\$-gon is constructible is a product of any number of distinct Fermat primes and a power of 2 \2ドル\$(ie. n = 2^k * p1 * p2 * ...\$n = 2^k \times p_1 \times p_2 \times ...\$ with k\$k\$ being an integer and every p\$p_i\$ some distinct Fermat prime).

A Fermat prime is a prime which can be expressed as F(n)=2^(2^n)+1 whith n\2ドル^{2^n}+1\$ with \$n\$ a positive integer. The only known Fermat primeprimes are for 0, 1, 2, 3 and 4.\$n = 0, 1, 2, 3 \text{ and } 4\$

The challenge

Given an integer n>2\$n>2\$, say if the n\$n\$-gon is constructible or not.

Specification

Your program or function should take an integer or a string representing said integer (either in unary, binary, decimal or any other base) and return or print a truthy or falsy value.

This is code-golf, so shortest answer wins, standard loopholes apply.

Relevant OEIS

Examples

3 -> True
9 -> False
17 -> True
1024 -> True
65537 -> True
67109888 -> True
67109889 -> False

A constructible n-gon is a regular polygon with n sides that you can construct with only a compass and an unmarked ruler.

As stated by Gauss, the only n for which a n-gon is constructible is a product of any number of distinct Fermat primes and a power of 2 (ie. n = 2^k * p1 * p2 * ... with k being an integer and every p some distinct Fermat prime).

A Fermat prime is a prime which can be expressed as F(n)=2^(2^n)+1 whith n a positive integer. The only known Fermat prime are for 0, 1, 2, 3 and 4.

The challenge

Given an integer n>2, say if the n-gon is constructible or not.

Specification

Your program or function should take an integer or a string representing said integer (either in unary, binary, decimal or any other base) and return or print a truthy or falsy value.

This is code-golf, so shortest answer wins, standard loopholes apply.

Relevant OEIS

Examples

3 -> True
9 -> False
17 -> True
1024 -> True
65537 -> True
67109888 -> True
67109889 -> False

A constructible \$n\$-gon is a regular polygon with n sides that you can construct with only a compass and an unmarked ruler.

As stated by Gauss, the only \$n\$ for which a \$n\$-gon is constructible is a product of any number of distinct Fermat primes and a power of \2ドル\$(ie. \$n = 2^k \times p_1 \times p_2 \times ...\$ with \$k\$ being an integer and every \$p_i\$ some distinct Fermat prime).

A Fermat prime is a prime which can be expressed as \2ドル^{2^n}+1\$ with \$n\$ a positive integer. The only known Fermat primes are for \$n = 0, 1, 2, 3 \text{ and } 4\$

The challenge

Given an integer \$n>2\$, say if the \$n\$-gon is constructible or not.

Specification

Your program or function should take an integer or a string representing said integer (either in unary, binary, decimal or any other base) and return or print a truthy or falsy value.

This is code-golf, so shortest answer wins, standard loopholes apply.

Relevant OEIS

Examples

3 -> True
9 -> False
17 -> True
1024 -> True
65537 -> True
67109888 -> True
67109889 -> False
Commonmark migration
Source Link

A constructible n-gon is a regular polygon with n sides that you can construct with only a compass and an unmarked ruler.

As stated by Gauss, the only n for which a n-gon is constructible is a product of any number of distinct Fermat primes and a power of 2 (ie. n = 2^k * p1 * p2 * ... with k being an integer and every p some distinct Fermat prime).

A Fermat prime is a prime which can be expressed as F(n)=2^(2^n)+1 whith n a positive integer. The only known Fermat prime are for 0, 1, 2, 3 and 4.

The challenge

#The challenge GivenGiven an integer n>2, say if the n-gon is constructible or not.

Specification

#Specification YourYour program or function should take an integer or a string representing said integer (either in unary, binary, decimal or any other base) and return or print a truthy or falsy value.

This is code-golf, so shortest answer wins, standard loopholes apply.

Relevant OEIS

#Examples

Examples

3 -> True
9 -> False
17 -> True
1024 -> True
65537 -> True
67109888 -> True
67109889 -> False

A constructible n-gon is a regular polygon with n sides that you can construct with only a compass and an unmarked ruler.

As stated by Gauss, the only n for which a n-gon is constructible is a product of any number of distinct Fermat primes and a power of 2 (ie. n = 2^k * p1 * p2 * ... with k being an integer and every p some distinct Fermat prime).

A Fermat prime is a prime which can be expressed as F(n)=2^(2^n)+1 whith n a positive integer. The only known Fermat prime are for 0, 1, 2, 3 and 4.

#The challenge Given an integer n>2, say if the n-gon is constructible or not.

#Specification Your program or function should take an integer or a string representing said integer (either in unary, binary, decimal or any other base) and return or print a truthy or falsy value.

This is code-golf, so shortest answer wins, standard loopholes apply.

Relevant OEIS

#Examples

3 -> True
9 -> False
17 -> True
1024 -> True
65537 -> True
67109888 -> True
67109889 -> False

A constructible n-gon is a regular polygon with n sides that you can construct with only a compass and an unmarked ruler.

As stated by Gauss, the only n for which a n-gon is constructible is a product of any number of distinct Fermat primes and a power of 2 (ie. n = 2^k * p1 * p2 * ... with k being an integer and every p some distinct Fermat prime).

A Fermat prime is a prime which can be expressed as F(n)=2^(2^n)+1 whith n a positive integer. The only known Fermat prime are for 0, 1, 2, 3 and 4.

The challenge

Given an integer n>2, say if the n-gon is constructible or not.

Specification

Your program or function should take an integer or a string representing said integer (either in unary, binary, decimal or any other base) and return or print a truthy or falsy value.

This is code-golf, so shortest answer wins, standard loopholes apply.

Relevant OEIS

Examples

3 -> True
9 -> False
17 -> True
1024 -> True
65537 -> True
67109888 -> True
67109889 -> False
Tweeted twitter.com/StackCodeGolf/status/772764565088112640

A constructible n-gon is a regular polygon with n sidesides that you can construct with only a compass and an unmarked ruler.

As stated by Gauss, the only nn for which a nn-gon is constructible is a product of any number of distinct Fermat primes and a power of 2 (ie.

That is, n=n = 2^k * p1 * p2 *... with k being an integer and k ≥ 0, and every p1**pxp is asome distinct Fermat prime).

A Fermat prime is a prime which can be expressed as F(n) =2 ^(2^n)+1 withF(n)=2^(2^n)+1 whith n a positive integer. The only known Fermat primesprime are for n ⊂ [0,4]0, 1, 2, 3 and 4.

Given#The challenge Given an integer n>2 say if the n-n>2, say if the n-gon is constructible or not.

#Specification Your program or function should take an integer or a string representing said integer (either in unary, binary, decimal or any other base) and return or print a truthy or falsy value.

This is code-golf, so shortest answer wins., Standardstandard loopholes apply.

Relevant oeisOEIS

#Examples

3 -> True
9 -> False
17 -> True
1024 -> True
65537 -> True
67109888 -> True
67109889 -> False

A constructible n-gon is a regular polygon with n side that you can construct with only a compass and an unmarked ruler.

As stated by Gauss, the only n for which a n-gon is constructible is a product of any number of distinct Fermat primes and a power of 2.

That is, n= 2^k * p1 * p2 *... with k an integer and k ≥ 0, and p1**px is a distinct Fermat prime.

A Fermat prime is a prime which can be expressed as F(n) =2 ^(2^n)+1 with n a positive integer. The only known Fermat primes are for n ⊂ [0,4].

Given an integer n>2 say if the n-gon is constructible or not.

#Specification Your program or function should take an integer or a string representing said integer (either in unary, binary, decimal or any other base) and return or print truthy or falsy.

This is code-golf, so shortest answer wins. Standard loopholes apply.

Relevant oeis

#Examples

3 -> True
9 -> False
17 -> True
1024 -> True
65537 -> True
67109888 -> True
67109889 -> False

A constructible n-gon is a regular polygon with n sides that you can construct with only a compass and an unmarked ruler.

As stated by Gauss, the only n for which a n-gon is constructible is a product of any number of distinct Fermat primes and a power of 2 (ie. n = 2^k * p1 * p2 *... with k being an integer and every p some distinct Fermat prime).

A Fermat prime is a prime which can be expressed as F(n)=2^(2^n)+1 whith n a positive integer. The only known Fermat prime are for 0, 1, 2, 3 and 4.

#The challenge Given an integer n>2, say if the n-gon is constructible or not.

#Specification Your program or function should take an integer or a string representing said integer (either in unary, binary, decimal or any other base) and return or print a truthy or falsy value.

This is code-golf, so shortest answer wins, standard loopholes apply.

Relevant OEIS

#Examples

3 -> True
9 -> False
17 -> True
1024 -> True
65537 -> True
67109888 -> True
67109889 -> False
Corrected Spelling; Fixed grammar; Improved Formatting
Source Link
Riker
  • 7.9k
  • 4
  • 40
  • 73
Loading
Source Link
Sefa
  • 580
  • 4
  • 20
Loading

AltStyle によって変換されたページ (->オリジナル) /