Domande taggate «arithmetic»

Sfide legate all'aritmetica elementare.

7
Golf gli pseudoprimi!
Introduzione / Contesto In una recente discussione nella chat crittografica sono stato sfidato a discutere / aiutare con il test di primalità di Fermat e i numeri di Carmichael. Questo test si basa sulla premessa che a^(p-1) mod p==1sarà sempre valida per i numeri primi p, ma non sempre per …
9 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 

13
Espandi catene di confronto
A differenza di molti linguaggi, Python valuta a<b<cin quanto sarebbe stato fatto nel campo della matematica, in realtà a confronto i tre numeri, al contrario di confrontare il booleano a<ba c. Il modo corretto di scrivere questo in C (e molti altri) sarebbe a<b && b<c. In questa sfida, il …
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
Dato un input int n, stampa n * invertito (n)
Dato un numero intero n, stampan * reversed(n) reversed(n)è il numero che ottieni quando hai reversele cifre di 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 Vince …
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 

15
Implementa il metodo di Eulero
L'obiettivo di questa sfida è utilizzare il metodo di Eulero per approssimare la soluzione di un'equazione differenziale della forma f (n) (x) = c. † L'ingresso sarà una lista di interi in cui il n esimo valore rappresenta il valore di f (n) (0). Il primo numero intero è f …

11
Crea ogni combinazione di gruppi variabili fino all'ordine n
SPECIFICHE Date le mvariabili, crea ogni combinazione fino all'ordine n. Per esempio, L'output della mappatura di due variabili ( ae b) da ordinare 1sarebbe: un' B ab L'output della mappatura di due variabili ( ae b) da ordinare 2sarebbe: un' a 2 B b 2 ab a 2 b ab …

2
Le 10.000 parole più comuni
Questa domanda è scritta perché "Thing Explainer" è divertente da leggere e mi ha dato un'idea. Scrivi "cose ​​che fanno fare al computer cose" che legge / prende un insieme di lettere, numeri e cose del genere "#%|?e ritorna True / 1se tutte le parole fanno parte di questo insieme …
9 code-golf  string  parsing  code-golf  array-manipulation  random  permutations  code-golf  string  code-golf  parsing  code-golf  string  quine  code-golf  string  parsing  comment  code-golf  string  counting  natural-language  code-golf  string  decision-problem  code-golf  math  code-challenge  metagolf  test-battery  code-golf  string  code-golf  math  number  arithmetic  source-layout  code-golf  number  primes  decision-problem  code-golf  math  arithmetic  code-golf  date  code-golf  string  cryptography  code-golf  code-golf  chess  board-game  code-golf  geometry  grid  puzzle-solver  set-partitions  code-golf  number  natural-language  code-golf  ascii-art  code-golf  math  code-golf  string  ascii-art  kolmogorov-complexity  code-golf  string  natural-language  code-golf  game  board-game  tic-tac-toe  code-golf  ascii-art  hexagonal-grid  code-golf  string  comment  code-golf  internet  code-golf  sorting  code-golf  kolmogorov-complexity  unicode  code-golf  tips  code-golf  string  natural-language  code-golf  string  kolmogorov-complexity  source-layout  hello-world  code-golf  string  kolmogorov-complexity  counting  natural-language  code-golf  random  quine  code-golf  string  math  bitwise  code-golf  permutations  code-golf  string  code-golf  arithmetic 

7
La sequenza di Szekeres
Definizione a(1) = 1 a(2) = 2 a(n)è il numero più piccolo k>a(n-1)che evita qualsiasi progressione aritmetica a 3 termini in a(1), a(2), ..., a(n-1), k. In altre parole, a(n)il numero più piccolo è k>a(n-1)tale che non esiste x, ydove 0<x<y<ne a(y)-a(x) = k-a(y). Esempio risolto Per n=5: abbiamo a(1), …


3
Semplifica una data
Questo è simile alla semplificazione delle frazioni, ma con Date! L'input del programma deve essere nel formato mm/dd Ad esempio 3/4 //March 4 12/15 //December 15 1/1 // January 1 Partiamo dal presupposto che l'input sarà valido in modo che i mesi contengano questi numeri di giorni: January 31 February …

6
Calcola la somma di Kronecker di due matrici
Negli esempi che seguono, Ae Bsarà di 2-by-2 matrici e le matrici sono uno indicizzate. Un prodotto Kronecker ha le seguenti proprietà: A⊗B = A(1,1)*B A(1,2)*B A(2,1)*B A(2,2)*B = A(1,1)*B(1,1) A(1,1)*B(1,2) A(1,2)*B(1,1) A(1,2)*B(1,2) A(1,1)*B(2,1) A(1,1)*B(2,2) A(1,2)*B(2,1) A(1,2)*B(2,2) A(2,1)*B(1,1) A(2,1)*B(1,2) A(2,2)*B(1,1) A(2,2)*B(1,2) A(2,2)*B(2,1) A(2,2)*B(1,2) A(2,2)*B(2,1) A(2,2)*B(2,2) Una somma di Kronecker ha …

3
Verifica il numero di nascita
Un numero di nascita norvegese è composto da 11 cifre, composte nel modo seguente: DDMMYYiiikk DD è il giorno (dal 01-31) MM è il mese (dal 01-12) YYè l'anno (dalle 00-99). Non è differenziato tra il 1900 e il 2000 iii è il "numero individuale" kk sono due cifre di …

2
Risolvi un'espressione matematica dai lati alternati
Crea un programma che risolva un'espressione matematica usando gli elementi dai lati alternati dell'espressione. Il modo in cui è fatto è, invece di leggere da sinistra a destra, leggi il primo carattere, poi l'ultimo, poi il secondo, quindi il secondo all'ultimo, ecc. Questo ti darà una nuova espressione che devi …

6
Calcola il simbolo Kronecker
Rilevanti collegamenti qui e qui , ma ecco la versione breve: Hai un input di due numeri interi ae btra infinito negativo e infinito (anche se se necessario, posso limitare l'intervallo, ma la funzione deve comunque accettare input negativi). Definizione del simbolo di Kronecker È necessario restituire il simbolo Kronecker …

2
Cambio base ereditaria
sfondo In questa sfida, una rappresentazione baseb di un numero intero nè un'espressione di nuna somma di poteri di b, in cui ogni termine si verifica nella maggior parte dei b-1casi. Ad esempio, la 4rappresentazione base di 2015è 4^5 + 3*4^4 + 3*4^3 + 4^2 + 3*4 + 3 Ora, …

15
Somma delle stringhe senza conversione
Devi prendere 2 input di stringa e generare la somma di queste due stringhe senza convertirle in int o utilizzare qualsiasi tipo di dato numerico. ex. string one = "123"; string two = "456"; string sum = "579"; Supponiamo che le stringhe non siano più grandi di 10 cifre. Questo …
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.