Pertanyaan yang diberi tag «rational-numbers»

Tantangan ini melibatkan manipulasi bilangan rasional, yaitu bilangan yang dapat direpresentasikan sebagai pecahan bilangan bulat. Jangan gunakan tag ini jika angka rasional hanyalah salah satu dari beberapa format input / output yang dapat diterima, melainkan jika penggunaan aritmatika rasional yang tepat diperlukan.


4
Hitung norma p-adic dari bilangan rasional
Hitung norma p-adic dari bilangan rasional Tulis fungsi atau program, yang mengambil 3 bilangan bulat m,n,p(di mana pbilangan prima positif) sebagai input, yang menampilkan norma p-adic (dilambangkan dengan |m/n|_p) sebagai fraksi (dikurangi sepenuhnya). Fermat diketahui hanya memiliki margin yang sangat kecil, tetapi yang agak tidak diketahui adalah bahwa ia hanya …

2
X lebih besar dari 3 dengan setidaknya 2 perbedaan antara X dan Y
Saya mencoba untuk menurunkan C ++. Apakah mungkin membuat kondisi ini lebih pendek? X > 3 & X - Y > 1 (Selain menghapus spasi putih, tentu saja.) Jadi, Xsetidaknya 4tapi X >= Y + 2. Xdan Ybilangan bulat dalam interval [0,5]. Saya telah mencoba menemukan beberapa formula bitwise tetapi …
11 code-golf  number  tips  c++  code-golf  popularity-contest  obfuscation  code-golf  c  code-golf  board-game  hexagonal-grid  code-golf  game  grid  code-golf  number  permutations  popularity-contest  math  graphical-output  number-theory  king-of-the-hill  code-challenge  compression  code-challenge  fastest-code  code-golf  math  ascii-art  animation  code-golf  popularity-contest  generation  counting  fastest-code  fastest-code  popularity-contest  image-processing  king-of-the-hill  code-golf  conversion  binary-tree  code-golf  math  number  rational-numbers  division  code-golf  restricted-source  hashing  atomic-code-golf  logic-gates  code-golf  function  code-challenge  puzzle-solver  ai-player  test-battery  popularity-contest  music  compression  code-golf  number  stack  atomic-code-golf  logic-gates  ascii-art  popularity-contest  code-golf  date  grid  code-challenge  game  code-golf  parsing  code-golf  math  geometry  sequence  popularity-contest  code-trolling  code-golf  string  restricted-source  code-golf  quine  king-of-the-hill  code-golf  math  code-golf  simulation  code-golf  ascii-art  code-challenge  sorting  optimization 

9
Temukan posisi pecahan di pohon Stern-Brocot
Pohon Stern-Brocot adalah pohon biner fraksi di mana setiap fraksi diperoleh dengan menambahkan pembilang dan penyebut dari dua fraksi yang berdekatan di tingkat di atas. Ini dihasilkan dengan memulai dengan 0/1dan 1/0sebagai "fraksi titik akhir", dan dari sana, iterasi dengan menempatkan satu fraksi antara setiap pasangan fraksi berturut-turut dengan menambahkan …

6
Fungsi Menghitung Rasional
Buat fungsi yang mengambil bilangan alami (mulai dari 0 inklusif), dan mengembalikan sepasang bilangan bulat positif, yang masing-masing adalah pembilang dan penyebut. Gunakan traversal diagonal. Nomor yang dihitung sebelumnya harus dilewati. (Anda dapat menghafal sekumpulan nilai yang dilewati) Diagram: Merah adalah nilai yang dilewati Nilai: f (0) = 1, 1 …

3
Menghitung Resistance (Nerd Sniping)
Pegolf Sore yang Baik, Tantangan kami untuk hari ini terinspirasi oleh komik XKCD 356 dan 370 . Kita akan menulis sebuah program untuk menghitung resistansi sekelompok resistor. Sebuah peringatan bahwa ini hampir cukup sulit untuk menjamin menjadi tantangan kode, namun saya pikir ada seni tertentu untuk menulis program yang sedikit …

7
Perkirakan kelima sempurna
Mulai dari 1-TET, berikan temperamen yang sama yang memiliki perkiraan yang lebih baik dan lebih baik dari kelima sempurna (rasio hanya 3/2). ( Urutan OEIS A060528 ) Deskripsi formal urutan, disalin dari OEIS: Daftar temperamen yang sama (pembagian yang sama dari oktaf) yang langkah skala terdekatnya mendekati dan mendekati perkiraan …

7
Kode-Golf: Urutan Farey (I)
Tantangan Dalam tugas ini Anda akan diberi bilangan bulat N (kurang dari 10 ^ 5), menampilkan urutan Farey dari urutan N. Input N diberikan dalam satu baris, input diakhiri oleh EOF. Memasukkan 4 3 1 2 Keluaran F4 = {0/1, 1/4, 1/3, 1/2, 2/3, 3/4, 1/1} F3 = {0/1, 1/3, …
10 code-golf  math  code-golf  math  code-golf  number  number-theory  code-golf  math  arithmetic  repeated-transformation  code-golf  geometry  popularity-contest  code-golf  code-golf  tips  haskell  math  fastest-algorithm  code-golf  combinatorics  code-golf  math  polynomials  rational-numbers  code-golf  code-golf  popularity-contest  javascript  code-golf  kolmogorov-complexity  code-golf  code-golf  math  combinatorics  permutations  code-challenge  restricted-source  random  array-manipulation  code-challenge  generation  code-golf  code-golf  ascii-art  arithmetic  division  code-challenge  number  code-golf  math  number  binary  code-golf  ascii-art  code-golf  interpreter  stack  code-golf  internet  networking  code-golf  math  code-golf  ascii-art  code-golf  math  sequence  code-golf  hello-world  restricted-source  code-golf  ascii-art  code-golf  geometry  code-golf  kolmogorov-complexity  pi  code-golf  math  combinatorics  permutations  code-golf  math  code-challenge  ascii-art  code-golf  string  code-golf  quine  code-golf  math  floating-point  golfscript  code-golf  string  code-golf  sliding-puzzle  code-challenge  arithmetic  code-golf  math  code-golf  geometry  optimized-output 

13
Luaskan Chains Perbandingan
Tidak seperti kebanyakan bahasa, Python mengevaluasi a<b<ckarena akan dilakukan dalam matematika, sebenarnya membandingkan tiga angka, yang bertentangan dengan membandingkan boolean a<buntuk c. Cara yang benar untuk menulis ini dalam C (dan banyak lainnya) adalah a<b && b<c. Dalam tantangan ini, tugas Anda adalah untuk memperluas rantai perbandingan dengan panjang sewenang-wenang …
9 code-golf  parsing  conversion  syntax  code-golf  sequence  primes  code-challenge  geometry  optimization  code-golf  graph-theory  code-golf  number-theory  primes  integer  code-golf  source-layout  cops-and-robbers  code-golf  source-layout  cops-and-robbers  code-golf  sequence  primes  integer  code-golf  math  number-theory  primes  rational-numbers  code-golf  math  sequence  number-theory  primes  code-golf  string  code-golf  math  combinatorics  permutations  restricted-complexity  code-golf  array-manipulation  code-golf  number  sequence  code-golf  number  sequence  code-golf  binary-matrix  code-golf  math  tips  javascript  algorithm  code-golf  string  code-golf  number  sequence  code-golf  math  arithmetic  parsing  code-golf  number  sequence  primes  code-golf  string  ascii-art  geometry  integer  code-golf  geometry  code-golf  number  array-manipulation  code-golf  math  geometry  code-golf  number  sequence  arithmetic  integer  code-golf  string  kolmogorov-complexity  code-golf  number  code-golf  number  chess  code-golf  sequence  decision-problem  subsequence  code-golf  math  number  primes  code-golf  primes  permutations  code-golf  integer  probability-theory  statistics  code-golf  string  code-golf  sequence  decision-problem  parsing  board-game  code-golf  binary  graph-theory  code-golf  board-game  classification  tic-tac-toe  code-golf  ascii-art  polyglot  code-golf  date  code-golf  geometry 

30
Diberikan input int n, cetak n * terbalik (n)
Diberikan bilangan bulat n, cetakn * reversed(n) reversed(n)adalah angka yang Anda dapatkan ketika Anda reversedigit n. reverse(512) = 215 reverse(1) = 1 reverse(101) = 101 >>>>>>>> func(5) = 5*5 = 25 func(12) = 12*21 = 252 func(11) = 11*11 = 121 func(659) = 659*956 = 630004 Kode terpendek menang! Papan …
9 code-golf  math  arithmetic  code-golf  math  integer  code-golf  arithmetic  integer  code-golf  sequence  base-conversion  palindrome  code-golf  math  primes  integer  code-golf  parsing  conversion  syntax  code-golf  sequence  primes  code-challenge  geometry  optimization  code-golf  graph-theory  code-golf  number-theory  primes  integer  code-golf  source-layout  cops-and-robbers  code-golf  source-layout  cops-and-robbers  code-golf  sequence  primes  integer  code-golf  math  number-theory  primes  rational-numbers  code-golf  math  sequence  number-theory  primes  code-golf  string  code-golf  math  combinatorics  permutations  restricted-complexity  code-golf  array-manipulation  code-golf  number  sequence  code-golf  number  sequence  code-golf  binary-matrix  code-golf  math  tips  javascript  algorithm  code-golf  string  code-golf  number  sequence  code-golf  math  arithmetic  parsing  code-golf  number  sequence  primes  code-golf  string  ascii-art  geometry  integer  code-golf  geometry  code-golf  number  array-manipulation  code-golf  math  geometry  code-golf  number  sequence  arithmetic  integer  code-golf  string  kolmogorov-complexity  code-golf  number  code-golf  number  chess  code-golf  sequence  decision-problem  subsequence  code-golf  math  number  primes  code-golf  primes  permutations  code-golf  integer  probability-theory  statistics  code-golf  string  code-golf  sequence  decision-problem  parsing  board-game  code-golf  binary  graph-theory  code-golf  board-game  classification  tic-tac-toe  code-golf  ascii-art  polyglot  code-golf  date  code-golf  geometry 



14
Tampilkan Fraksi Lanjutan
Tantangan Anda adalah mengubah pecahan menjadi bentuk pecahan berkelanjutan. Input : Fraksi dapat berupa input dalam format apa pun, termasuk (tetapi tidak terbatas pada) string: "7/16" daftar: {7, 16}, (7, 16), [7, 16] pasangan sederhana yang dipesan: 7 16 fungsi: f [7,16] Keluaran : Fraksi lanjutan, dalam 2D, dengan bilah …

1
Fraksi frenzy!
EDIT: Saya mendapatkan banyak komentar tentang ini tidak berakhir - saya akan memberikan tag "jawaban yang benar" baik kepada orang pertama yang memberi saya FF(3)(seperti dalam memberikannya dalam jawaban mereka) atau membuktikan bahwa FF(3)memang memang meledak tanpa batas. Tugas: Tugas Anda adalah membuat program sekecil mungkin yang menghasilkan daftar kebalikan …

16
Bepergian di Bumi yang datar
Koordinat di dunia flat-Earth terdiri dari garis lintang (x) dan garis bujur (y), yang merupakan bilangan bulat dalam kisaran 0 ... 9999. Sama seperti bilangan bulat Gaussian , tetapi selalu ditulis menggunakan notasi ini: 411S 370E Yaitu, dengan Satau Nditambahkan ke garis lintang, dan Eatau Wditambahkan ke garis bujur, dengan …
8 code-challenge  arithmetic  parsing  code-golf  interpreter  code-golf  random  classification  code-golf  ascii-art  code-golf  code-golf  string  number  array-manipulation  code-golf  math  rational-numbers  code-golf  internet  classification  code-golf  string  integer  code-golf  number  graphical-output  typography  king-of-the-hill  code-golf  number  sequence  palindrome  code-golf  math  code-golf  math  probability-theory  code-challenge  image-processing  test-battery  code-golf  number-theory  code-golf  tips  swift  code-golf  graphical-output  image-processing  color  code-golf  string  conversion  code-golf  string  array-manipulation  code-golf  encryption  king-of-the-hill  code-golf  string  ascii-art  code-golf  code-golf  string  compression  decision-problem  code-golf  ascii-art  number-theory  division  code-golf  ascii-art  code-golf  code-golf  number  array-manipulation  code-golf  ascii-art  code-golf  code-golf  string  code-golf  sequence  number-theory  code-golf  math  geometry  code-golf  combinatorics  code-golf  integer  code-golf  arithmetic  number-theory  code-golf  arithmetic  restricted-source  number-theory  restricted-complexity 

Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.