# Tag Info

2

ARM T32 machine code, 34 bytes b510 0001 d00c 2001 2204 3204 2302 3302 3001 001c 4364 1b14 d4f7 07a4 41a1 d1f6 bd10 Following the AAPCS, this takes a 0-based index in r0 and returns the 0-based entry at that index in r0. Assembly: .section .text .syntax unified .global sequence .thumb_func sequence: push {r4, lr} @ Save r4 and lr to the stack ...

0

Charcoal, 10 bytes Ｉ⌊Φθ⁼↔ι⌈↔θ Try it online! Link is to verbose version of code. Takes input as a list of two (actually arbitrary many) integers (which need not be distinct). Explanation: Outputs the element with the greatest absolute value, or the less of two elements tied for absolute value. Explanation: θ Input list Φ Filter where ...

0

Jelly, 15 bytes Ḥ½ḶoƊ€ḊŻĖS€ḂFTḣ A monadic Link accepting $i$ which yields a list of the first $i$ terms. Try it online! How? Ḥ½ḶoƊ€ḊŻĖS€ḂFTḣ - Link: positive integer, i Ḥ - double -> 2i € - for each (x in [1..2i]): Ɗ - last three links as a monad, f(x): ½ - square root (x) -> r Ḷ ...

1

Charcoal, 10 bytes ＩＥＮ‽Ｘ²¦¹²⁸ Try it online! Link is to verbose version of code. Explanation: Ｎ Input integer Ｅ Map over implicit range Ｘ²¦¹²⁸ 2¹²⁸ ‽ Random integer (0-indexed) Ｉ Cast to string Implicitly print

0

05AB1E, 19 bytes Prints an infinite list of the 1-based sequence. ∞ε©tLε®+Éy®≠›‹]˜ƶ0K Try it online! ∞ε ] # for n in [1, 2, ...]: © # store n in the register tL # range from 1 to sqrt(n) ε ] # for k in this range: ®+É # is n+k odd? y®≠› ...

1

Jelly, 18 bytes ²‘½€RḂ¬ÐeḊŻ$€FT1;ḣ Try it online! A monadic link taking an integer $n$ and returning the first $n$ terms of the sequence. 4 Python 3, 67 bytes Prints the 0-based sequence forever. d=n=k=0 while 1:k+=1;k**=k*k<=n;n+=k<2;k+n&1<(k>1%n)!=print(d);d+=1 Try it online! Commented: d=n=k=0 while 1: k+=1 # increment k k**=k*k<=n # k=k**1=k if k*k<=n, else k=k**0=1 n+=k<2 # increment n if k is equal to 1 ... 2 COW, 183 bytes oomMMMmoOMMMmoOoomMMMmoOMMMmOomOoMMMmoOmoOmoOMMMMMMmoOMMMmOomOoMMMmoOmoOmoOMMMMMMmoOMMMmOoMOOmOomOomOomOomOomOoMOOMOomoOmoOMOOMoOmoOmoOMOOMoOmoOmoOMOoMMMOOOmooOOOmooOOOmooMMMmoomoOOOM Try it online! Returns the smaller integer. It increases and decreases both, the first to reach 0 (with precedence to the decreasing one) is the smaller. : n ... 0 Excel, 62 bytes =MID(CONCAT((RANDARRAY(A1*128)>0.5)*1),SEQUENCE(A1,,,128),128) Link to Spreadsheet Excel doesn't handle 128 bit integers. What this returns is technically n strings of 128 random 1s and 0s, which could be interpreted as n 128 bit binary integers. If Excel did handle 128 bit integers, then answer would be =RANDARRAY(A1,,,2^128-1,1) which ... 2 Japt, 5 bytes Outputs true for the first number being higher or false for the second. ²+V>² Try it 4 Vyxal, 5 bytes ²?Ḣ+⇧ Try it Online! Takes input as a list and returns [1,0] for first being bigger, [0,1] for second being bigger. ² # [x^2, y^2] ?Ḣ # [y] + # [x^2+y, y^2] ⇧ # Grade up 2 Jelly, 4 bytes Ḥc2Ụ Try it online! Alternative grade-up solution. Uses (2n)C2 = n(2n-1) as the grade key function. This function maps 0, 1, -1, 2, -2, 3, -3, ... to 0, 1, 3, 6, 10, 15, 21, ..., i.e. the triangular numbers. This allows a shorter APL solution: APL(Dyalog Unicode), 5 bytes SBCS ⍋2!+⍨ Try it on APLgolf! 1 Jelly, 5 4 bytes ²+ḊỤ Try it online! Terrible port of xnor's Python solution, also stealing from hyper-neutrino's Jelly solution ovs's output format ([1, 2] if y is greater, [2, 1] if x is greater). Takes input as a list [x, y]. ² [x^2, y^2] + plus Ḋ [y]: ²+Ḋ [x^2 + y, y^2]. Ụ Grade up. 2 Vyxal, 7 bytes ȧ4*?±-⇧ Try it Online! Oh yes, jelly port. Very fun. ⟨0|1⟩ for second integer being yes, ⟨1|0⟩ for first integer being yes. Explained ȧ4*?±-⇧ ȧ4* # 4 * abs(input) [vectorised] # call this x ?± # sign_of(input) [vectorised - <0 = -1, =0 = 0, >0 = 1] # call this y - # x - y [vectorised element-wise] # call this z ⇧ # ... 1 Scala, 37 bytes _.maxBy(x=>if(x>0)x*2-1 else x.abs*2) Try it online! Very simple, simply takes a list containing the two number, maps each to its index in the sequence, and finds the max according to that. 1 C (gcc), 20 bytes f(a,b){a=a*a>b*b-b;} Try it online! Port of xnor's Python answer. 1 APL (Dyalog Unicode), 6 bytes A port of hyper-neutrino's Jelly answer. Outputs are swapped. ⍋×-4×| Try it online! g gets the "higher" number according to the output. 11 Python, 20 bytes lambda x,y:x*x>y*y-y Try it online! Checks whether $x^2>y^2-y$. Outputs True/False for whether x comes after y in the listing. Note that we're not asked handle the case x==y. To see that this works, note that each of the x*x value in the table is greater than all the y*y-y values to the left of it, but none to the right of it. ... 6 J, 8 bytes >&(-3^|) Try it online! Or verbose: (x - 3 ^ abs(x)) > (y - 3 ^ abs(y)). This maps the inputs to the following sequence to compare them in: 0 1 _1 2 _2 3 _3 4 _4 5 _5 _1 _2 _4 _7 _11 _24 _30 _77 _85 _238 _248 If sorted input as output is allowed, then 7 byte /:*.@%: is another fun way to sort /: the input list: *. ... 1 Wolfram Language (Mathematica), 19 bytes Most@*SortBy[-# #&] Try it online! -23 bytes from @att 3 Python 3, 29 26 bytes Returns True if a is a at a higher index than b, False otherwise. lambda a,b:a*a+(a<0)/2>b*b Try it online! 1 Python 2, 30 bytes lambda x,y:(x*x,x<0)>(y*y,y<0) Attempt This Online! This is one of those irritating ones that can't be shortened with a loop because the loop is only over 2 items. The abs(x) -> x*x trick was taken from ovs' answer. 6 Desmos, 21 bytes f(x,y)=\{xx-x<yy,0\} (Newline is required) Edit: Just noticed that xnor's answer is very similar to mines, but I found this independently. Function is $f(x,y)$, and it returns $0$ if $x$ has a higher index, otherwise returns $1$. This seems to work, but I just randomly stumbled upon it, so I can't explain how it works. Try It On ... 3 Jelly, 5 bytes ²Ḥ_ṠỤ Try It Online! -1 byte thanks to ovs -1 byte thanks to Unrelated String Returns [1, 2] if the first integer comes first and [2, 1] for the second integer. ²Ḥ_ṠỤ Main Link; accepts a list ² x ** 2 Ḥ 2 * (x ** 2) _Ṡ 2 * (x ** 2) - sign(x) Ụ Grade up 0 => 0 1 => 1 -1 => 3 2 => 7 -2 => 9 3 =&... 5 Husk, 7 bytes F>m€Θİ± Try it online! Returns 1 if the second is larger than the first, 0 otherwise 1 CJam, 20 19 bytes ri{L{2mr+}128*2bN}* Try it online! CJam, 27 24 bytes (Old method) ri{8,{G*YG#(mr\m<}%:+N}* Try it online! Edit: had a better idea using the "repeat N times" operator. Saved 3 characters. Edit 2: tried a completely new algorithm. Saved 4 characters. Edit 3: went for the string manipulation side of things. Saved 1 character. 2 JavaScript (Browser), 99 bytes n=>crypto.getRandomValues(a=new BigUint64Array(n*2)).reduce((r,v,i)=>i&1?[v<<64n|a[i^1],...r]:r,[]) This feature is introduced eailer this month by this post. And it currently requires a recent version of Firefox / Chromium Nightly build to run. It is a sad story that words crypto, getRandomValues, ... 2 Wolfram Language (Mathematica), 25 24 bytes –1 byte thanks to Bubbler! RandomInteger[4^64-1,#]& Try it online! I wrote this and even I can't find anything interesting to say about it 2 PowerShell, 57 bytes 41 bytes @(1..$n|%{(Random 1.0)*("2*"*128+1|iex)}) Explanation: 1..$n enumerates integers from 1 to$n, % is an alias to ForEach-Object, Random decimal between 0 and 1.0, multiply by 2^128 through this clever obfuscation. @() encapsulates the result in an array, save 3 bytes if a actual array isn't needed. Try it online! ...

2

Scala, 49 bytes def f(n:Int)=Seq.fill(n)(BigInt(128,util.Random)) Try it online!

2

R, 24 22 bytes Edit: -1 byte thanks to pajonk runif(scan())*4^64%/%1 Try it online! Output is an integer uniformly selected from the range 0...2^128-1. R does not natively support 128-bit inteters, so the data type of the output is a floating-point representation (click here for a TIO link that dispays all the digits, instead of displaying in scientific ...

3

Julia 1.0, 18 bytes !n=rand(UInt128,n) Try it online! sorry, boring useful built-in

2

Raku, 17 bytes {roll ^4**64: $_} Try it online! ^4**64 is the range of numbers [0, 2¹²⁸). The roll method returns randomly selected numbers from that range, in the quantity of$_, the input argument.

1

Japt, 7 bytes ÇMq2pIÑ Ç // Create the range [0..U) where U is the input, then map each value to Mq // a random non-negative integer smaller than 2 // 2 p // to the power of IÑ // 64 * 2. Try it here.

1

Perl 5, 51 bytes sub{join('',map chr rand 256,1..16*pop)=~/.{16}/sg} Try it online! Creates n random 128 bit integers. Or n strings of 16 random 8 bit chars. How to print the array elements as decimal numbers can be seen by clicking the "Try it online" link.

2

C (gcc), 68 42 bytes f(n,a)char*a;{for(n*=16;n--;)a[n]=rand();} Try it online! takes an 0 array and the number requested as input the array I taken as *char to be manipulated byte by byte so that we set every 8bit to rand() which is RAND_MAX e.g. At least 32767 and thus guaranteed to affect every bit numbers printed as decimal thanks to this good answer ...

3

Factor, 33 31 bytes [ [ 128 2^ random ] replicate ] Try it online! replicate Create a sequence given a number of elements and a generating quotation. 128 2^ 2128 random Return a uniformly random number (via Factor's default Mersenne Twister PRNG) from 0 to whatever number is on top of the data stack minus one.

2

Ruby, 29 Bytes ->n{n.times.map{rand 2**128}} Try It Online

3

Befunge-98 (PyFunge), 57 37 bytes &'wa+0> #;\1-:9j;+1?;#*2\_$.1-:!#@_1j Try it online! Note that the input has to have a trailing space because of a bug in the interpreter. The part generating a random 128-bit number bit by bit is explained below: 'wa+0> #;\1-:9j;+1?;#*2\_\.@ Try it online! 'wa+ push loop counter, ... 12 x86-64 machine code, 10 bytes Fortunately, there is a built-in RNG. Requires the RDRAND instruction. 00000000: c1e1 020f c7f0 abe2 fac3 .......... Disassembled: shl ecx, 2 label: rdrand eax stosd loop label ret Outputs to a pre-allocated buffer in rdi. n is passed in ecx (arrays with 2^30 elements and more are not supported). Try it ... 5 JavaScript (Node.js), 72 70 bytes Saved 2 bytes thanks to @RedwolfPrograms The helper function g builds a 128-bit integer, one bit at a time. This seems a bit long... n=>Array(n).fill(128n).map(g=k=>k--&&BigInt(Math.random()<.5)|2n*g(k)) Try it online! 1 Jelly, 7 bytes Ø⁷2*X’) Try it online! A monadic link taking a single argument and returning a list of random 128-bit unsigned integers of that length. Explanation ) | For each value from 1..n Ø⁷ | 128 2* | 2 ** that X | Random Int from 1 to that ’ | Subtract 1 If the output can be from 1 to $2^{128}$ rather than 0 to \$2^{128} ...

2

Haskell, 64 bytes k=length f l|sum l==0=l|h:t<-l=f t#(f.init)l a#b|k a>k b=a|1>0=b Try it online! f return longest sublist by checking if list sum is 0 or choosing the best result coming from recursively inspecting tail and init a# b used by f to choose longest result

2

Python 2 54 53 bytes: Try it online! lambda n:map(randrange,[4**64]*n) from random import* 69 bytes: Try it online! lambda n:[int(os.urandom(i).encode('hex'),i)for i in*n] import os Python 3 54 bytes: Try it online! lambda n:[*map(randbits,*n)] from secrets import* 57 56 bytes: Try it online! lambda n:[*map(randrange,[4**64]*n)] from random ...

5

Vyxal, 7 bytes ƛ₇ƛ₀℅;B Try it Online! ƛ # Map... ₇ƛ ; # Map 128 to... ₀℅ # Random choice from digits of 10 B # Convert to base 10 Or if it's allowed not to complete within the lifetime of the universe, 5 bytes: ƛ₇Eʁ℅ Try it Online! ƛ # Map... ₇E # 2 ** 128 ʁ # Range (0...x) ℅ # Choose a random item It's trying to ...

1

Stax, 7 bytes é╟φQRl: Run and debug it

1

Charcoal, 75 bytes ≔⁻²⪪024420¹ε≔⁻²⪪343101¹δＮθＦＮＦθ«Ｊ×κ§ε⊖ι×κ§δ⊖ιＦ⊕κ«ＧＨV→^←².Ｍ§ε⊕ι§δ⊕ι»»≔ＬＫＡζ⎚Ｉζ Try it online! Link is to verbose version of code. Takes input as size and sections. Explanation: Far too long because it doesn't try to use a formula, but guarantees 100% correct answers. ≔⁻²⪪024420¹ε≔⁻²⪪343101¹δ Create displacement vectors for each of the six ...

0

JavaScript (Node.js), 38 36 bytes n=>k=>n*n*k+(k<6&&n*4+2-k-(n>1&k>4)) -2 bytes thanks to Shaggy Try it online!

4

Python 2, 38 bytes lambda n,k:k*n*n+(4*n-k+2-k/5%n)*(k<6) Try it online! Not sure about its correctness. But it at least passed all testcases. -2 bytes by dingledooper -5 bytes by xnor

0