Mükemmel miyim (sayı)?


26

Bu benim ilk meydan okumam!

Arka fon

Mükemmel sayı pozitif bir tamsayıdır, kendisi hariç tüm bölenlerinin toplamına eşittir.
Öyleyse 6mükemmel bir sayı 1 + 2 + 3 = 6.
Öte yandan 12, çünkü değil 1 + 2 + 3 + 4 + 6 = 16 != 12.

Görev

Görevin basittir, verilen nmesajlardan birini basacak bir program yaz :

Ben mükemmel bir numarayım çünkü mükemmel bir numara d1 + d2 + ... + dm = s == n
değilim çünküd1 + d2 + ... + dm = s [<>] n

Nerede
d1, ... dmtüm bölenler bazıları nhariç n.
sTüm bölenlerin toplamıdır d1, ..., dm(yine, olmadan n).
[<>]ya <(eğer s < n) ya da >(eğer s > n) 'dir.

Örnekler

İçin nolan 6"1 + 2 + 3 = 6 == 6, çünkü mükemmel bir sayı değilim":
için nolan 12"bir tam sayı değilim 1 + 2 + 3 + 4 + 6 = 16> 12, çünkü,"
için nbir varlık 13: "Mükemmel bir numara değilim çünkü 1 = 1 <13"

kurallar

  • ndilinizin standartlarından daha büyük değil int.
  • nStandart girişten, komut satırı argümanlarından veya bir dosyadan okuyabilirsiniz .
  • Çıktı mesajı standart çıktıya yazdırılmalıdır ve çıktıda ek karakter görünemez (izleyen boşluk veya satırsonu olabilir)
  • Görevi (veya ana bölümünü) sizin için çözecek herhangi bir yerleşik veya kütüphane işlevi kullanamazsınız. Hayır GetDivisors()ya da onun gibi bir şey.
  • Diğer tüm standart boşluklar geçerlidir.

kazanan

Bu yani bayt cinsinden en kısa kod kazanır!


@orlp Yapmadım, mücadeleyi düzelttim, bunun için teşekkürler.
— Zereges,

7
Neden kullanıyorsunuz =ve ==aynı denklemde? Bu hiç mantıklı değil. d1 + d2 + ... + dm = s = nIMO olmalı .
— orlp

Bazı örnek giriş ve çıkışları verebilir misiniz, örneğin 6 ve 12 girişleriyle?
— Zgarb

14
@Zereges Bu saçmalık. Atanan hiçbir şey yok. Sadece karşılaştırıldı.
— orlp

1
@orlp Amaçlanmıştır.
— Zereges,

Yanıtlar:


4

Pyth, 81 bayt

jd[+WK-QsJf!%QTStQ"I am"" not""a perfect number, because"j" + "J\=sJ@c3"==<>"._KQ

Çevrimiçi deneyin: Gösteri veya Test Paketi

Açıklama:

                                 implicit: Q = input number
               StQ               the range of numbers [1, 2, ..., Q-1]
          f                      filter for numbers T, which satisfy:
           !%QT                     Q mod T != 0
         J                       save this list of divisors in J
      -QsJ                       difference between Q and sum of J
     K                           save the difference in K

jd[                              put all of the following items in a list
                                 and print them joined by spaces: 
                  "I am"           * "I am"
   +WK                  " not"       + "not" if K != 0
"a perfect number, because"        * "a perfect ..."
j" + "J                            * the divisors J joined by " + "
       \=                          * "="
         sJ                        * sum of J
            c3"==<>"               * split the string "==<>" in 3 pieces:
                                        ["==", "<", ">"]
           @        ._K              and take the (sign of K)th one (modulo 3)
                       Q           * Q

9

Java, 255 270 bayt (17 numaralı tabanda hala FF)

class C{public static void main(String[]a){int i=new Integer(a[0]),k=0,l=0;a[0]=" ";for(;++k<i;)if(i%k<1){l+=k;a[0]+=k+" ";}}System.out.print("I am "+(l==i?"":"not ")+"a perfect number, because "+a[0].trim().replace(" "," + ")+" = "+l+(l==i?" == ":l<i?" < ":" > ")+i);}}

Ve daha okunabilir bir versiyon:

class C {
    public static void main(String[] a) {
        int i = new Integer(a[0]), k = 0, l = 0;
        a[0] = " ";
        for(; ++k<i ;){
            if (i % k == 0) {
                l += k;
                a[0] += k + " ";
            }
        }
        System.out.print("I am " + (l == i ? "" : "not ") + "a perfect number, because " + a[0].trim().replace(" "," + ") + " = " + l + (l == i ? " == " : l < i ? " < " : " > ") + i);
    }
}

Daha önce garip numaralar için işe yaramadı, bu yüzden birkaç şey ince ayar yapmak zorunda kaldı. En azından bayt sayımla tekrar şanslı oldum. :)


l == 255 üzerinde mi çalışacağım?
— dwana

Bayt sayınızı bozup bozmadığını biliyorum, ancak bir [0] 'un son üç (dört) oluşumunu bir' String b 'ile değiştirerek bir karakteri kaydedebilir ve onların yerine' b 'yi kullanabilirsiniz
— Craig

6

R, 158 163 157 153 143 141 bayt

Hala golf oynamak için bu sanırım.
Düzenleme: Değiştirilen if(b<n)'<'else if(b>n)'>'else'=='ile c('<'[b<n],'>'[b>n],'=='[b==n]). Bir paste(...)ile değiştirilir rbind(...)[-1]. Birkaç bayt için teşekkürler @plannapus.

n=scan();a=2:n-1;b=sum(w<-a[!n%%a]);cat('I am','not'[b!=n],'a perfect number, because',rbind('+',w)[-1],'=',b,c('<'[b<n],'>'[b>n],'==')[1],n)

Ungolfed

n<-scan()             # get number from stdin
w<-which(!n%%1:(n-1)) # build vector of divisors
b=sum(w)              # sum divisors
cat('I am',           # output to STDOUT with a space separator
    'not'[b!=n],      # include not if b!=n
    'a perfect number, because',
    rbind('+',w)[-1], # create a matrix with the top row as '+', remove the first element of the vector
    '=',
    b,                # the summed value
    c(                # creates a vector that contains only the required symbol and ==
        '<'[b<n],     # include < if b<n
        '>'[b>n],     # include > if b>n
        '=='
    )[1],             # take the first element 
    n                 # the original number
)

Test sürüşü

> n=scan();b=sum(w<-which(!n%%1:(n-1)));cat('I am','not'[b!=n],'a perfect number, because',rbind('+',w)[-1],'=',b,c('<'[b<n],'>'[b>n],'==')[1],n)
1: 6
2: 
Read 1 item
I am a perfect number, because 1 + 2 + 3 = 6 == 6
> n=scan();b=sum(w<-which(!n%%1:(n-1)));cat('I am','not'[b!=n],'a perfect number, because',rbind('+',w)[-1],'=',b,c('<'[b<n],'>'[b>n],'==')[1],n)
1: 12
2: 
Read 1 item
I am not a perfect number, because 1 + 2 + 3 + 4 + 6 = 16 > 12
> n=scan();b=sum(w<-which(!n%%1:(n-1)));cat('I am','not'[b!=n],'a perfect number, because',rbind('+',w)[-1],'=',b,c('<'[b<n],'>'[b>n],'==')[1],n)
1: 13
2: 
Read 1 item
I am not a perfect number, because 1 = 1 < 13
> 

+Bölenler arasında oturum açılmalıdır .
— Zereges,

@Zereges Bunu daha yeni farkettim ve kısa bir süre sonra çözeceğim
— MickyT

Parlak rbindnumara için +1 ! Eğer atarsanız Sen 2 ekstra bayt kaydedebilirsiniz 2:n-1bir değişkene söylemek a: which(!n%%1:(n-1)) böylece olur a[!n%%a]. (Tam kod o zaman n=scan();a=2:n-1;b=sum(w<-a[!n%%a]);cat('I am','not'[b!=n],'a perfect number, because',rbind('+',w)[-1],'=',b,c('<'[b<n],'>'[b>n],'==')[1],n))
— plannapus

@plannapus Teşekkürler, kendimden çok memnun kaldım.
— MickyT

5

Python 2,183 173 170 bayt

b=input();c=[i for i in range(1,b)if b%i<1];d=sum(c);print'I am %sa perfect number because %s = %d %s %d'%('not '*(d!=b),' + '.join(map(str,c)),d,'=<>='[cmp(b,d)%3::3],b)

Örnekler:

$ python perfect_number.py <<< 6
I am a perfect number because 1 + 2 + 3 = 6 == 6
$ python perfect_number.py <<< 12
I am not a perfect number because 1 + 2 + 3 + 4 + 6 = 16 > 12
$ python perfect_number.py <<< 13
I am not a perfect number because 1 = 1 < 13
$ python perfect_number.py <<< 100
I am not a perfect number because 1 + 2 + 4 + 5 + 10 + 20 + 25 + 50 = 117 > 100
$ python perfect_number.py <<< 8128
I am a perfect number because 1 + 2 + 4 + 8 + 16 + 32 + 64 + 127 + 254 + 508 + 1016 + 2032 + 4064 = 8128 == 8128

13 byte kaydettiğin için xnor'a teşekkürler !


4
'=<>'[cmp(b,d)]- devrime katıl!
— orlp

Mükemmel, teşekkürler! Oh, bekle ... :)
— Celeo

1
@Celeo Benzer bir çözüm buldum. Sen yazabilir b%i<1için b%i==0. Çünkü ['not ',''][int(d==b)], intPython otomatik olarak dönüştürüleceği için buna ihtiyacınız yok . Ayrıca, dize mulitplication kullanabilirsiniz "not "*(d!=b).
— xnor,

@xnor Önerileriniz için teşekkürler!
— Celeo

1
@Celeo orlp'nin önerisini olarak çalışacak şekilde ayarlayabilirsiniz "=<>="[cmp(b,d)%3::3].
— xnor

4

Julia, 161 157 bayt

n=int(ARGS[1])
d=filter(i->n%i<1,1:n-1)
s=sum(d)
print("I am ",s!=n?"not ":"","a perfect number, because ",join(d," + ")," = $s ",s<n?"<":s>n?">":"=="," $n")

Ungolfed:

# Read n as the first command line argument
n = int(ARGS[1])

# Get the divisors of n and their sum
d = filter(i -> n % i == 0, 1:n-1)
s = sum(d)

# Print to STDOUT
print("I am ",
      s != n ? "not " : "",
      "a perfect number, because ",
      join(d, " + "),
      " = $s ",
      s < n ? "<" : s > n ? ">" : "==",
      " $n")

4

CJam, 90 bayt

"I am"rd:R{R\%!},:D:+R-g:Cz" not"*" a perfect number, because "D'+*'=+D:++'=C+_'=a&+a+R+S*

Karşılaştırma için, tek bir yazdırma =83 baytta sağlanabilir.

CJam tercümanında çevrimiçi olarak deneyin .

Nasıl çalışır

"I am"  e# Push that string.
rd:R    e# Read a Double from STDIN and save it in R.
{       e# Filter; for each I in [0 ... R-1]:
  R\%!  e# Push the logical NOT of (R % I).
},      e# Keep the elements such that R % I == 0.
:D      e# Save the array of divisors in D.
:+R-g   e# Add the divisors, subtract R and compute the sign of the difference.
:Cz     e# Save the sign in C and apply absolute value.
"not "* e# Repeat the string "not " that many times.

" a perfect number, because "

D'+*    e# Join the divisors, separating by plus signs.
'=+D:++ e# Append a '=' and the sum of the divisors.
'=C+    e# Add the sign to '=', pushing '<', '=' or '>'.
_'=a&   e# Intersect a copy with ['='].
+a+     e# Concatenate, wrap in array and concatenate.
        e# This appends "<", "==" or ">".
R+      e# Append the input number.
S*      e# Join, separating by spaces.

2

Perl, 148 Bayt

$a=<>;$_=join' + ',grep{$a%$_==0}1..$a-1;$s=eval;print"I am ".($s==$a?'':'not ')."a perfect number because $_ = $s ".(('==','>','<')[$s<=>$a])." $a"

Satır sonları ile:

$a=<>;
$_=join' + ',grep{$a%$_==0}1..$a-1;
$s=eval;
print"I am ".($s==$a?'':'not ')."a perfect number because $_ = $s ".(('==','>','<')[$s<=>$a])." $a"

Bunun üzerine bir körü yaşadım ve çevresinde dış parens kaldırarak 10 bayt kaydedebilir 'not 've '==','>','<'tablolar ve geçiş .için ,(zaman hiçbir şey beri eklenir printbir liste ing). Ayrıca ödevlerinizi ilk kez kullanıldıklarında parenlere taşımak bir kaç kişiyi kurtarır ve mantığı biraz değiştirirseniz grep$a%_<1,1..($a=<>)-1ve $a!=($s=eval)&&'not 'birkaçını daha fazla tıraş etmelisiniz! Tüm bu mantıklı umarım!
— Dom Hastings,

2

Lua, 244 231 bayt

golfed:

n=io.read("*n")d={}s="1"t=1 for i=2,n-1 do if n%i==0 then table.insert(d,i)s=s.." + "..i t=t+i end end print(("I am%s a perfect number, because %s = %s"):format(t==n and""or" not", s, t..(t==n and" == "or(t>n and" > "or" < "))..n))

Ungolfed:

n=io.read("*n")
divisors={}
sequence="1"
sum=1
for i=2,n-1 do
    if n%i==0 then 
        table.insert(divisors,i)
        sequence=sequence.." + "..i
        sum=sum+i
    end
end

print(("I am%s a perfect number, because %s = %s"):format(sum==n and""or" not", sequence, sum..(sum==n and" == "or(sum>n and" > "or" < "))..n))

2

JavaScript (ES6), 146

Şablon dizelerini kullanarak, Firefox'ta ve en son Chrome'da çalışır.

for(n=prompt(),o=t=i=1;++i<n;)n%i||(t+=i,o+=' + '+i)
alert(`I am ${t-n?'not ':''}a perfect number because ${o} = ${t} ${t<n?'<':t>n?'>':'=='} `+n)


2

Ruby, 174 160 155 136 134 128 122 Bayt

n=6;a=[*1...n].reject{|t|n%t>0};b=a.inject(:+)<=>n;print"I am#{" not"*b.abs} a perfect number, because ",a*?+,"<=>"[b+1],n

Başka bir 6 bayt kaydedildi :)

Ruby'deki golf için ipuçları


Print komutu hala beni rahatsız ediyor .. if if ifadesini kısaltmanın bir yolunu bulmalı mıyım? başka bir maddeye ihtiyacım var
— Yuri Kazakov

sadece bir tane basım bildirimi kaldı :)
— Yuri Kazakov

1

C #, 252 bayt

class A{static void Main(string[]a){int i=int.Parse(a[0]);var j=Enumerable.Range(1,i-1).Where(o=>i%o==0);int k=j.Sum();Console.Write("I am "+(i!=k?"not ":"")+"a perfect number, because "+string.Join(" + ",j)+" = "+k+(k>i?" > ":k<i?" < ":" == ")+i);}}

1

Hassium , 285 Bayt

Feragatname: Komut satırı argümanları ile ilgili sorunlar nedeniyle sadece en son Hassium sürümüyle çalışır.

func main(){n=Convert.toNumber(args[0]);s=1;l="1";foreach(x in range(2,n-3)){if(n%x==0){l+=" + "+x;s+=x;}}if(s==n)println("I am a perfect number, because "+l+" = "+s+" == "+s);else {print("I am not a perfect number, because "+l+" = "+s);if(s>n)println(" > "+n);else println(" < "+n);}}

Daha okunabilir sürüm:

func main() {
    n = Convert.toNumber(args[0]);
    s = 1;
    l = "1";
    foreach(x in range(2, n - 3)) {
            if (n % x== 0) {
                    l += " + " + x;
                    s += x;
            }
    }
    if (s == n)
            println("I am a perfect number, because " + l + " = " + s + " == " + s);
    else {
            print("I am not a perfect number, because " + l + " = " + s);
            if (s > n)
                    println(" > " + n);
            else
                    println(" < " + n);
    }

}


1
1. Hassium'u komut satırı argümanlarımı okuması için ikna edemiyorum. Eğer idam edersem mono src/Hassium/bin/Debug/Hassium.exe t.hs 6yazıyor System.ArgumentException: The file 6 does not exist.. 2. Bu, bu zorluğun yayınlanmasından önceki en son taahhüt olan bu sürümle çalışmaz . Lütfen gönderiminizin rekabet dışı olduğunu belirten bir feragatname ekleyin.
— Dennis,

Windows'ta (MVS2015 kullanılarak oluşturulmuş) denedim ve aynı hatayı gördüm.
— Zereges

Bu, tam anlamıyla 15 dakika önce güncellenen bir konudur. Hassium'u klonlayın ve tekrar derleyin. Aynı sorunu yaşadığım için çok üzgünüm.
— Jacob Misirian

1
En son sürümle iyi çalışır. Şimdi, feragatnameyi ekleyebiliyorsanız, oyumun düşürülmesinden memnuniyet duyarım. (Bu arada, @Dennisyorumuna ekleyerek bana ping yapabilirsin . Aksi takdirde, cevabın için bildirimde bulunamam.)
— Dennis

@Dennis Ekledim. Bildiriminiz için teşekkür ederim :)
— Jacob Misirian

1

MATLAB, 238

Asla en kısa dillerden biri olmayacaksın, fakat işte MATLAB'a girişmem:

n=input('');x=1:n-1;f=x(~rem(n,x));s=sum(f);a='not ';b=strjoin(strtrim(cellstr(num2str(f')))',' + ');if(s>n) c=' > ';elseif(s<n) c=' < ';else c=' == ';a='';end;disp(['I am ' a 'a perfect number, because ' b ' = ' num2str(s) c num2str(n)])

Ve bu biraz daha okunabilir bir biçimde:

n=input();      %Read in the number using the input() function
x=1:n-1;        %All integers from 1 to n-1
f=x(~rem(n,x)); %Determine which of those numbers are divisors
s=sum(f);       %Sum all the divisors
a='not ';       %We start by assuming it is not perfect (to save some bytes)
b=strjoin(strtrim(cellstr(num2str(f')))',' + '); %Also convert the list of divisors into a string 
                                                 %where they are all separated by ' + ' signs.
%Next check if the number is >, < or == to the sum of its divisors
if(s>n)  
    c=' > ';    %If greater than, we add a ' > ' to the output string
elseif(s<n) 
    c=' < ';    %If less than, we add a ' < ' to the output string
else
    c=' == ';   %If equal, we add a ' == ' to the output string
    a='';       %If it is equal, then it is a perfect number, so clear the 'not' string
end

%Finally concatenate the output string and display the result
disp(['I am ' a 'a perfect number, because ' b ' = ' num2str(s) c num2str(n)])

Bir işlev kullanmadan 2 bayt daha kaydetmeyi başardım. Bunun yerine kod satırını çalıştırıyorsunuz ve sayıyı giriş olarak istiyor. Çalıştıktan sonra sonunda çıktı görüntüler.


1

Perl 6 , 138 bayt

$_=get;
my$c=$_ <=>my$s=[+] my@d=grep $_%%*,^$_;
say "I am {
    'not 'x?$c
  }a perfect number, because {
    join ' + ',@d
  } = $s {
    «> == <»[1+$c]
  } $_"

(Sayı, yeni hatları yok sayar ve girintiler, çünkü gerekli değildir)

@dbölenleri tutan dizi.
$sbölenlerin toplamını tutar.
$cgirdi ile bölenlerin toplamı arasındaki karşılaştırmanın değeridir.
(Etkili $cbiridir -1, 0, 1, ama gerçekten biridir Order::Less, Order::Sameya da Order::More)

In 'not 'x?$c, ?$cbu durumda etkili bir şekilde aynıdır abs $cve xdize tekrarı operatörüdür.

«> == <»için kısa ( '>', '==', '<' ).
Yana $cbirine sahip -1,0,1, bir liste halinde dizin kullanmak edebilmek için tek doğru kaydırmak zorunda.

Teknik olarak bu, 2 above'nin üzerindeki sayılar için işe yarar, ancak 2¹⁶'nin üzerindeki sayılar için hatalı bir süre alır.


0

Pyth, 84 bayt

jd+,+"I am"*.aK._-QsJf!%QTtUQ" not""a perfect number, because"+.iJm\+tJ[\=sJ@"=<>"KQ

Geçersiz cevap, ben uygulamak çünkü inkar =ve ==aynı denklemde.


2
+1, "aynı denklemde" = = = = "yi reddettiği için
— theonlygusti 16:15

0

Ruby, 164 Bayt

->i{t=(1...i).select{|j|i%j==0};s=t.inject &:+;r=['==','>','<'][s<=>i];puts "I am #{'not ' if r!='=='}a perfect number, because #{t.join(' + ')} = #{s} #{r} #{i}"}

Ölçek

irb(main):185:0> ->i{t=(1...i).select{|j|i%j==0};s=t.inject &:+;r=['==','>','<'][s<=>i];puts "I am #{'not ' if r!='=='}a perfect number, because #{t.join(' + ')} = #{s} #{r} #{i}"}.call 6
I am a perfect number, because 1 + 2 + 3 = 6 == 6

irb(main):186:0> ->i{t=(1...i).select{|j|i%j==0};s=t.inject &:+;r=['==','>','<'][s<=>i];puts "I am #{'not ' if r!='=='}a perfect number, because #{t.join(' + ')} = #{s} #{r} #{i}"}.call 12
I am not a perfect number, because 1 + 2 + 3 + 4 + 6 = 16 > 12

irb(main):187:0> ->i{t=(1...i).select{|j|i%j==0};s=t.inject &:+;r=['==','>','<'][s<=>i];puts "I am #{'not ' if r!='=='}a perfect number, because #{t.join(' + ')} = #{s} #{r} #{i}"}.call 13
I am not a perfect number, because 1 = 1 < 13

0

Emacs Lisp, 302 Bayt

(defun p(n)(let((l(remove-if-not'(lambda(x)(=(% n x)0))(number-sequence 1(- n 1)))))(setf s(apply'+ l))(format"I am%s a perfect number, because %s%s = %s %s %s"(if(= s n)""" not")(car l)(apply#'concat(mapcar'(lambda(x)(concat" + "(number-to-string x)))(cdr l)))s(if(= sum n)"=="(if(> sum n)">""<"))n)))

Ungolfed versiyonu:

(defun perfect (n)
  (let ((l (remove-if-not '(lambda (x) (= (% n x) 0))
              (number-sequence 1 (- n 1)))))
    (setf sum (apply '+ l))
    (format "I am%s a perfect number, because %s%s = %s %s %s" (if (= sum n)"" " not") (car l)
        (apply #'concat (mapcar '(lambda (x) (concat " + " (number-to-string x))) (cdr l)))
        sum (if(= sum n)
            "=="
          (if(> sum n)
              ">"
            "<"))
        n)))

0

Powershell, 164 bayt

$a=$args[0]
$b=(1..($a-1)|?{!($a%$_)})-join" + "
$c=iex $b
$d=$a.compareto($c)
"I am $("not "*!!$d)a perfect number, because $b = $c $(("==","<",">")[$d]) $a"

PoSh hilelerinin ortak ve pek yaygın olmayan püf noktaları;

  • Toplamı oluşturun, ardından iex ile değerlendirin
  • Gt, lt, eq dizisini dizine eklemek için Compareto
  • !! $ d $ d = 1 veya -1 için true == 1, $ d = 0 için false == 0 olarak değerlendirilir.

0

awk, 150

n=$0{for(p=i=s=n>1;++i<n;)for(;n%i<1;p+=i++)s=s" + "i;printf"I am%s a perfect number, because "s" = "p" %s "n RS,(k=p==n)?_:" not",k?"==":p<n?"<":">"}

Giriş için bu doğru hale getirme bazı baytlar boşa 1. Bunun beklenen olup olmadığından emin değilim.

n=$0{
    for(p=i=s=n>1;++i<n;)
        for(;n%i<1;p+=i++)s=s" + "i;
    printf "I am%s a perfect number, because "s" = "p" %s "n RS,
           (k=p==n)?_:" not",k?"==":p<n?"<":">"
}

0

05AB1E , 58 bayt

„I€ÜIѨ©OIÊi'€–}“€…íÀ‚³,ƒ«“®vy'+}\'=®ODI.S"==><"211S£sèIðý

Çevrimiçi deneyin veya tüm test durumlarını doğrulayın .

Açıklama:

„I€Ü              # Push dictionary string "I am"
IѨ               # Push the divisors of the input-integer, with itself removed
   ©              # Store it in the register (without popping)
    O             # Get the sum of these divisors
     IÊi   }      # If it's not equal to the input-integer:
        '€–      '#  Push dictionary string "not"
“€…íÀ‚³,ƒ«“       # Push dictionary string "a perfect number, because"
®v   }            # Loop `y` over the divisors:
  y'+            '#  Push the divisor `y`, and the string "+" to the stack
      \           # Discard the final "+"
       '=        '# And push the string "="
®O                # Get the sum of the divisors again
  D               # Duplicate it
I.S               # Compare it to the input-integer (-1 if smaller; 0 if equal; 1 if larger)
   "==><"         # Push string "==><"
         211S£    # Split into parts of size [2,1,1]: ["==",">","<"]
              sè  # Index into it (where the -1 will wrap around to the last item)
I                 # Push the input-integer again
ðý                # Join everything on the stack by spaces
                  # (and output the result implicitly)

Benim bu 05AB1E ucu bakın (bölüm nasıl sözlüğü kullanılır? ) Anlamak için „I€Üise "I am", '€–olduğu "not"ve “€…íÀ‚³,ƒ«“olduğu "a perfect number, because".

Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.