New answers tagged math
1
vote
Auto-golf an esolang
Jelly, 45 bytes
¹©ṃ“D;ɼṛ6“+7“ṚḌ“D1;Ḍ%”Ṛv@ƒ6ṛ®ḊḌ⁼
1ç1#ṃ“!+~%”U
Try it online!
A pair of links called as a monad with an integer argument and returning a string ...
0
votes
1
vote
3
votes
Auto-golf an esolang
05AB1E, 47 bytes
"%!+~"∞5в0δKÙ.Δ´6svyiˆ6ëÐÂr1ìs%s7+)yè}}ˆ¯JQ}1ªè
Brute-force, so pretty slow. Outputs as a list of characters.
Try it online or verify ...
1
vote
Auto-golf an esolang
Charcoal, 79 65 bytes
⊞υ⟦ω⁶ω⟧Fυ¿¬ⅈ¿¬⌕ιθ⊟ι«≔§ι¹ηF⪪⟦η⁻⁶η!ω⁷+ω⁻⮌ηη~ω∧η⁻﹪XχLηηη%⟧³⊞υEκ⁺λ§ιμ
Try it online! Link is to verbose version of code. Explanation: Based on @...
2
votes
Auto-golf an esolang
JavaScript (Node.js), 121 119 bytes
f=(n,a='',b,c=6,...s)=>n!=b?f(n,...s,a+'+',b,c+7,a+'-',b,+[...c+''].reverse().join``,a+'%',b,('1'+c)%c,a+'!',[b]+c,6):a
Try ...
4
votes
Auto-golf an esolang
JavaScript (ES6), 139 bytes
-1 thanks to @l4m2
Expects the target integer as a string.
...
1
vote
Print 100 digits of Champernowne's Constant
05AB1E, 5 3 bytes
1т×
-2 bytes porting @Tbw's APL answer.
Outputs at 0-based index \$55555555555555555555555555555555555555555555555555551\$.
Try it online.
...
2
votes
Auto-golf an esolang
Python, 158 bytes
simple brute force approach, takes input as a (decimal) string
...
2
votes
What's the character limit of this text field?
Python 3, 55 bytes
lambda s:"".join(map(str,range(1,1001))).find(s)+len(s)
This is a rather simple solution, but it works.
2
votes
Print 100 digits of Champernowne's Constant
Vyxal H, 14 bitsv2, 1.75 bytes
1ẋ
Try it Online!
Bitstring:
01000010111110
Prints ...
1
vote
Print 100 digits of Champernowne's Constant
GolfScript, 6 bytes
55,(;5
Try it online!
Prints the first 100 digits.
...
2
votes
Print 100 digits of Champernowne's Constant
///, 17 bytes
/10/00000001/1100
Try it online!
Outputs 98 0s followed by 2 1s, which ...
4
votes
Print 100 digits of Champernowne's Constant
brainfuck, 23 bytes
-[----->+>+<<]>-[->..<]
Try it online!
Outputs 100 3s, which appears at index ...
1
vote
3
votes
Print 100 digits of Champernowne's Constant
Charcoal, 6 bytes
⭆⁵⁰⁺χι
Try it online! Link is to verbose version of code. Starts at index 9. Explanation: Loops over the ...
4
votes
Print 100 digits of Champernowne's Constant
APL (Dyalog Classic), 7 bytes
100⍴'1'
Try it online!
Prints 1, one hundred times. Similar approach to @Jonathan Allan and others.
First appears as
...
2
votes
Print 100 digits of Champernowne's Constant
APL+WIN, 11 10 bytes
i byte saved thank to Tbw
A function taking no arguments with output from index 2 with index origin = 1
1↓⊃,/⍕¨⍳55
Try it online! Thanks to ...
7
votes
Print 100 digits of Champernowne's Constant
C, 41 bytes
main(i){for(i=9;i++<59;)printf("%d",i);}
Goes through numbers 10 to 59 (indexes 9 to 108), printing exactly 100 digits (without a newline)....
9
votes
Print 100 digits of Champernowne's Constant
Jelly, 4 3 2 bytes
³Ṭ
A full program that accepts no arguments and prints a list of one hundred consecutive places starting at the 0-indexed index (you may need ...
4
votes
Print 100 digits of Champernowne's Constant
Jelly, 6 bytes
2r55DF
Try it online!
Starts at index 1 (digit 2 in the number 2). Range from 2 to 55 and then the decimal ...
3
votes
What's the character limit of this text field?
Charcoal, 10 bytes
I⁺Lθ⌕⭆φ⊕ιθ
Try it online! Link is to verbose version of code. Explanation:
...
2
votes
What's the character limit of this text field?
APL (Dyalog Classic), 22 bytes
≢-1-(⊃∘⍸⍷∘(⊃,/⍕¨⍳1E3))
Try it online!
...
2
votes
What's the character limit of this text field?
Pip, 10 bytes
Semi-port of lyxal's Vyxal answer
J1,a~:Xa$)
Attempt This Online!
...
3
votes
What's the character limit of this text field?
APL+WIN, 35 33 bytes
Two bytes saved thanks to Tbw
Prompts for string of digits:
↑(¯1+⍴s)+((s←,⎕)⍷n)/⍳⍴n←⊃,/⍕¨⍳1E3
Try it online! Thanks to Dyalog Classic
0
votes
Collatz, Sort, Repeat
Haskell, 96 bytes
(x:w)#h|x<=h!!0=x:w#h
x#y=y#x
g x=[div i 2|i<-x,even i]#[3*i+1|i<-x,odd i]
f 0=[1..]
f n=g$f$n-1
Try it online!
4
votes
What's the character limit of this text field?
Haskell, 65 63 bytes
-2 bytes thanks to @AZTECCO
n%h|l<-length n,n==take l h=l
n%(_:h)=1+n%h
f=(%([1..]>>=show))
Try it online!
4
votes
What's the character limit of this text field?
Perl 5 (-p), 27 bytes
(join"",1..1e3)=~$_;$_="@+"
Try it online!
6
votes
What's the character limit of this text field?
Excel (ms365)
1) Recursion with LAMBDA(), 74 bytes:
Formula in B1:
...
3
votes
What's the character limit of this text field?
Retina 0.8.2, 38 bytes
^
1001$*1¶
\G1
$.`
r`\B\1.*¶(.*)
$1
\B
Try it online! Link includes test cases. Explanation:
...
5
votes
What's the character limit of this text field?
Ruby, 34 30 bytes
->i{[*1..1e3]*''=~/(?<=#{i})/}
Try it online!
Thanks to @Neil for saving 1 Byte by removing useless + in regexp
Regexp /(?<=#{i})+/ ...
5
votes
What's the character limit of this text field?
05AB1E, 7 bytes
LJIkIg+
Times out for larger inputs. Add a leading ₄ (push 1000) to speed it up.
Try it online or verify all ...
5
votes
What's the character limit of this text field?
JavaScript (Node.js), 43 bytes
x=>~(g=s=>~s.indexOf(x,1)||g(s+i++))(x,i=1)
Try it online!
Using range, fail 11 (expect ...
5
votes
What's the character limit of this text field?
Vyxal, 50 bitsv2, 6.25 bytes
⌊ɾṅḟ?L+
Try it Online!
Bitstring:
11001011010011010000000111000101111000110100000010
Times out ...
2
votes
3
votes
Night hike partitioning
JavaScript (ES6), 106 bytes
-1 thanks to @l4m2
Expects a string with leading 1's for X's and trailing ...
3
votes
Night hike partitioning
Jelly, 15 bytes
I'm very prepared for a smarter approach to trounce this!
Œ!ŒṖ€ẎṢ€ṢẸƇƊƑƇQ
A monadic Link that accepts a list of zeros (no torch) and ones (has ...
6
votes
Night hike partitioning
Nekomata, 6 bytes
Ooᵐᵗžũ
Attempt This Online!
Takes input as a sorted list of 1s and 0s, ...
1
vote
Night hike partitioning
Charcoal, 52 bytes
⊞υ⟦⟧FS«≔υθ≔⟦⟧υFθ«Fκ⊞υEκ⎇⁼ν⌕κλ⁺μιμ¿⁼ιX⊞υ⊞OκX»»Φυ⁼κ⌕υι
Try it online! Link is to verbose version of code. Assumes the input contains ...
4
votes
2
votes
The vanilla factorial challenge
Vyxal 3L, 2 bytes
/*
Try it Online!
Fold / the input by multiplication *. Fold treats whole ...
0
votes
Minimum excluded number
Z80 machine language, 11 bytes
Base address of list in HL, length in BC.
AF C5 E5 ED B1 E1 C1 C0 3C 18 F6
Returns with mex in A unless it's at least 256, then ...
1
vote
Shift right by half a bit
JavaScript (Node.js), 31 bytes
n=>(g=i=>i*i*2<n*n?g(++i):i)(0)
Try it online!
or BigInt version, anyway really large values impractical to run
Brute-...
1
vote
Shift right by half a bit
Python 3.8 (pre-release), 40 bytes
This one works with python integers, giving the correct result even for arbitrarily large integers. Always rounds down.
...
2
votes
Count without 3
Swift, 84 bytes
func f(_ n:Int)->Int{var n=n+1;while String(n).contains("3")||n%3==0{n+=1};return n}
2
votes
1
vote
1
vote
Which skill to train?
Scala, 171 bytes
A port of @matteo_c's Haskell answer in Scala.
Golfed version. Try it online!
...
1
vote
1
vote
Count without 3
Google Sheets, 63 bytes
=+let(n,sequence(254),filter(n,n>A1,mod(n,3),iserr(find(3,n))))
Put the input in cell A1 and the ...
Top 50 recent answers are included
Related Tags
math × 1775code-golf × 1600
number × 296
sequence × 229
arithmetic × 183
number-theory × 171
geometry × 121
integer × 93
primes × 87
combinatorics × 86
decision-problem × 83
array × 75
code-challenge × 74
matrix × 70
polynomials × 60
string × 59
rational-numbers × 53
fastest-code × 50
abstract-algebra × 40
ascii-art × 38
base-conversion × 37
linear-algebra × 34
open-ended-function × 30
fibonacci × 29
restricted-source × 28