N입력 으로 정수가 주어지면, Npermutapalindromic 수를 출력하십시오 .
permutapalindromic number는 엄격하게 양의 정수로, 회문을 초래하는 숫자의 적어도 하나의 순열이 있습니다 (즉, 자체 역수).
예를 들어, 117숫자는 회 문인로 치환 될 수 있기 때문에 순열 171회문 번호입니다.
우리 는 회문 (palindrome) 10임에도 불구하고 같은 숫자 는 순열 통증 식 숫자가 아니라고 생각한다 01 = 1. 우리는 회 문장 순열 0이 앞에 0을 가져서는 안된다는 것을 강요한다 ( 그 자체는 순열 장 병원성이 아님).
이미 회 문인 숫자는 순열 회문이며, 순열은 유효하지 않기 때문입니다.
입력 및 출력
N0 색인 또는 1 색인 중 하나 일 수 있습니다. 두 가지 중 어느 것이 사용되는지 알려주십시오.- 입력은 
STDIN함수 인수 또는 선택한 언어와 비슷한 것으로 입력 할 수 있습니다 . 출력은에 쓰거나STDOUT함수에서 반환하거나 원하는 언어로 비슷한 것을 출력 할 수 있습니다 . - 입력과 출력은 10 진법이어야합니다.
 
테스트 사례
다음 테스트 사례는 1- 색인입니다. 귀하의 프로그램은 여기에 제시된 모든 테스트 사례를 최대 1 분 안에 통과 할 수 있어야합니다.
N      Output
1      1
2      2
3      3
4      4
5      5
6      6
7      7
8      8
9      9
10     11
42     181
100    404
128    511
256    994
270    1166
채점
이것은 code-golf 이므로 바이트 단위의 최단 답변이 이깁니다.
답변
05AB1E , 15  14 13 바이트
Emigna 덕분에 바이트를 절약했습니다 ! 암호:
µNœvyJÂïÊP}_½
설명:
µ               # c = 0, when c is equal to the input, print N.
 N              # Push N, the iteration variable.
  œ             # Push all permutations of N.
   vyJ    }     # For each permutation...
      Â         #   Bifurcate, which is short for duplicate and reverse.
       ï        #   Convert the seconds one to int, removing leading zeros.
        Q       #   Check if they are not equal.
         P      #   Product of the stack.
           _    # Logical not.
            ½   # Pop a value, if 1 then increase c by 1.
CP-1252 인코딩을 사용합니다 . 온라인으로 사용해보십시오! .
답변
Brachylog, 19 바이트
~l<:1at.
.=pPrPl~l?
약 17 초가 소요됩니다 N = 270.
설명
- 
주요 술어 :
~l Create a list whose length is Input. < The list is strictly increasing. :1a Apply predicate 1 to each element of the list. t. Output is the last element of the list. - 
술어 1 :
.= Input = Output = an integer pPrP A permutation P of the Output is its own reverse l~l? The length of P is equal to the length of the Input 
답변
Brachylog , 21 20 바이트
Fatalize 덕분에 1 바이트.
Brachylog의 과제를 설계 했습니까?
:1yt.
0<.={@epcPrP!}
270 분은 여기에 약 30 분이 걸립니다.
Z = 1166
real    0m27.066s
user    0m26.983s
sys     0m0.030s
Exit code:     0
술어 0 (주 술어)
:1yt.
:1y    find the first Input solutions to predicate 1
   t.  unify the output with the last element
술어 1 (보조 술어)
0<.={@epcPrP!}
0<.              0 < Output
  .=             Assign a value to Output (choice point)
    {        }   Inline predicate:
     @e              Digits of the Output
       p             A permutation (choice point)
        c            Concatenate (fails if leading zero present)
         P           store as P
          rP         assert that P reversed is still P
            !        remove the choice point in this predicate, so
                     that it will not return twice for the same number.
답변
피스, 14
e.ff&_ITshT.p`
확장:
e.ff&_ITshT.p`ZQ   # Auto-fill variables
 .f            Q   # Find the first input number of numbers that give truthy on ...
           .p`Z    # Take all the permutations of the current number
   f&              # Keep those that give a truthy value for both:
     _IT           # Invariance on reversing (is a palindrome)
        shT        # The integer value of the first digit (doesn't start with zero)
                   # A list with any values in it it truthy, so if any permutation matches
                   # these conditions, the number was a permutapalindrome
e                  # Take only the last number
답변
JavaScript (ES6), 99 바이트
f=(n,i=1)=>(n-=/^.0+$/.test(i)</^((.),\2,)*(.)(,\3)?(,(.),\6)*$/.test([...i+''].sort()))?f(n,i+1):i
설명:
f=(n,i=1)=>             look for n numbers starting at 1
 (n-=                   test whether current guess is
  /^.0+$/.test(i)<      not a round number and
  /^((.),\2,)*          pairs of comma-separated digits
   (.)(,\3)?            possible single digit
   (,(.),\6)*$/         pairs of comma-separated digits
   .test(               matches the comma-joined
    [...i+''].sort()))  digits in ascending order
 ?f(n,i+1)              if not n numbers found try next number
 :i                     found it!
답변
R, 145 바이트
g=function(n){d=b=0
while(d<n){b=b+1
if(sum(a<-table(strsplit(n<-as.character(b),""))%%2)==nchar(n)%%2&(!names(a)[1]==0|a[1]|sum(!a)>1))d=d+1}
b}
언 골프
f=function(b){
    a<-table(strsplit(n<-as.character(b),""))%%2
    sum(a)==nchar(n)%%2&(!names(a)[1]==0|a[1]|sum(!a)>1)
}
g=function(n){
    d=b=0
    while(d<n){
         b=b+a
         if(f(b)) d=d+1
    }
    b
}
본질적으로-permutapalindromic 세트의 멤버쉽을 확인하는 함수와 n 번째 멤버를 찾을 때까지 while 루프가 증가합니다.
답변
Python 2.7, 163154 바이트 :
from itertools import*;I,F,Q=input(),[],2
while len(F)<I:F=[g for g in range(1,Q)if any(i==i[::-1]*(i[0]>'0')for i in permutations(`g`))];Q+=1
print F[-1]
충분히 간단합니다. 기본적으로 while루프를 사용하여 배열이 포함 할 정도로 충분히 커질 [1,Q)때까지 범위 내에서 permutapalindromic 숫자를 포함하는 배열을 반복적으로 만듭니다.QInput 의 항목 수를 수 . 그런 다음 해당 배열의 마지막 요소를 출력합니다.