|
|
A343760
|
|
Numbers whose digits can be the lengths of the sides of a polygon.
|
|
1
|
|
|
111, 122, 133, 144, 155, 166, 177, 188, 199, 212, 221, 222, 223, 232, 233, 234, 243, 244, 245, 254, 255, 256, 265, 266, 267, 276, 277, 278, 287, 288, 289, 298, 299, 313, 322, 323, 324, 331, 332, 333, 334, 335, 342, 343, 344
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
The length of each side must be greater than 0 and less than the sum of the other sides.
Subset of the 0-free numbers, A052382, and eventually contains all the 0-free numbers > 9111111111.
|
|
LINKS
|
|
|
EXAMPLE
|
110 is not a term since the 3rd side has a length of 0.
111 is a term since a polygon (in this case a triangle) can have sides of length 1,1,1.
112 is not a term since the length of the 3rd side is not less than the sum of the other two sides.
|
|
MATHEMATICA
|
Select[Range[111, 344], AllTrue[TakeDrop[#, 1] & /@ Permutations@ IntegerDigits[#], First[#1] < Total[#2] & @@ # &] &] (* Michael De Vlieger, May 01 2021 *)
|
|
PROG
|
(Java)
public static void main(String[] args) {
for (long n = 1; n < 1000; n++) {
if (is(n)) {
System.out.print(n + ", ");
}
}
}
public static boolean is(long n) {
String s = String.valueOf(n);
if (n < 0 || s.contains("0")) {
return false;
}
int perimeter = 0;
char[] sides = s.toCharArray();
for (int i = 0; i < sides.length; i++) {
sides[i] -= '0';
perimeter += sides[i];
}
for (int side : sides) {
if (perimeter <= 2 * side) {
return false;
}
}
return true;
}
}
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|