# Tag Info

20

APL (Dyalog Unicode), 18 bytes +/∧/¨1<×\¨.5+,⍳⎕/2 Try it online! A full program. Fails to compute the answer for $k>15$ due to system limitations (rank of intermediate array). How it works If we call the $\frac{x}{2}$ the $D$-step and $\frac{3x+1}{2}$ as the $U$-step, it is known that each residue class $0 \dots 2^k-1$ modulo $2^k$ ...

17

JavaScript (ES7),  75  72 bytes Expects an array of ASCII codes. a=>a.map(g=k=>--d-1?g(k,d=n%d?d:++n):p*=n**(17088/k%75%14|1),d=p=n=1)&&p Try it online! Magic formula The formula 17088/k%75%14|1 was found by injecting random values into several handcrafted templates. More specifically, the template for this one was ${p}/k%${m0}%${m1}|1 with \... 17 J, 213 bytes Computes the lowest solution for each $n \leq 162$ on TIO. Also found out that the OEIS lowest values is apparently wrong, as you don't need to put every prime in a partition. Big thanks to @Neil for reminding me about modular arithmetic, otherwise I would have sit at $n=36$. :-) 3 :'N-~<./(0{[*|.(]-[*<.@%~)N*0}.@{_2{[:(]\:~@,:[-]*<.... 15 Python 3, 155, 126, 124, 123, 120 116, 113 bytes Yes! First python answer! Saved 21 bytes due to a suggestion by Dominic van Essen to remove the for loop! Saved 8 bytes because I realized I could use t*=True/False instead of t+=[True/False]. Saved another 2 bytes right after I finished editing because I realized t could simply be set to the same value as i ... 14 Jelly, 6 bytes R⁵*%i1 Try it online! Basically compute 10**[1..n] % n and get the 1-based index of 1. 14 Brachylog, 5 bytes That's basically this: "Determine if the number n is a composite number such that all prime factors of n are a subsequence of n". ḋṀ⊆ᵛ? Try it online! ḋṀ⊆ᵛ? (with implicit input n) ḋ get the prime factors of n Ṁ they must be Ṁany (at least 2 to filter out primes) ⊆ᵛ all of them must be an (ordered) subset of ? the ... 14 JavaScript (ES6), 29 bytes a=>a.map(v=>b[v]+=2,b=[0,-1]) Try it online! 13 Python 2, 61 bytes Wilson's theroem FTW! f=lambda p,a=1,b=1:p==[]or b**(a%b*p)*f(p[a%b:],a*b*b,b+1) Try it online! Python 2, 62 bytes f=lambda p,a=1,b=1:p==[]or(a%b<1or b**p.pop(0))*f(p,a*b*b,b+1) Try it online! 13 05AB1E, 3 bytes ΔÒJ Try it online! Δ run until the output doesn't change: Ò prime factors including duplicates J join into an integer 13 Jelly, 5 bytes :Æṣ’$ : integer divide Æṣ’$the decremented divisor sum This uses $\lfloor\frac{n}{\sigma(n)-n-1}\rfloor$ instead of $\frac{n-1}{\sigma(n)-n-1}$, but it still works because $\frac{1}{\sigma(n)-n-1}$ can never be greater than or equal to 1. Try it online! 13 JavaScript (V8), 72 71 70 69 bytes A full program that prints the sequence forever. for(n=1;c=2;c||print(n))for(d=++n;d--;)c>>=n==(h=n=>n&&h(n&n-1)+d)(d) Try it online! Commented for( // infinite outer loop: n = 1; // start with n = 1 c = 2; // before each iteration: initialize c ... 12 J, 12 bytes +2*/:<.&/:\: Try it online! Explanation: Self plus twice the minimum of ascending and descending ranks. Given a boolean array 1 1 0 0 1 1 1, ascending rank /:@/: and descending rank /:@\: are computed as follows: array: 1 1 0 0 1 1 1 asc. rank: 2 3 0 1 4 5 6 desc. rank: 0 1 5 6 2 3 4 minimum: 0 1 0 1 2 3 4 APL(Dyalog Unicode)... 12 Jelly, 12 bytes ,gþr’§Ạð+¥1# Try it online! -3 bytes thanks to caird coinheringaahing yeah this isn't gonna finish for 22 on TIO. You can find a more in-depth explanation and step-by-step process for solving and golfing a Jelly solution for this challenge in my YouTube video here. ,gþr’§Ạð+¥1# Main Link; accept k 1# nfind; find the first 1 ... 11 Risky, 44 bytes __0+0+_0+0+__0+0+_0+0+__0+0+_0+0+__0+0+_0+?1__0+0+_0+0+__0+0+_0!-_0!_{1+_0+0_[2_{0+__{1 Try it online! How it works: This is a really low level explanation: ... + __0+0+_0+? ; the input array 1 ; map with the following pairs: ... 10 Haskell, 85 bytes l=length k?x|elem x k=l$x:takeWhile(/=x)k|q<-show x=(x:k)?sum[read[k]^l q|k<-q] ([]?) Try it online! This is frustratingly long for Haskell. We have one main function here. It keeps track of a list k of numbers we already visited, appending new numbers to the front. Once we reach a number x which is on our list we return one more ...

10

J, 14 bytes (%+./)&.(_&q:) Try it online! (%+./)&.(_&q:) &.(_&q:) number to prime exponents (%+./) divide them by their GCD &.(_&q:) prime exponents to number

10

Scala 3, 49 44 bytes a=>b=>(-b*b to b*b)map(p=>a-p->p)find(_*_==b) Try it onlne! Takes (a)(b) and returns an Option[(Int, Int)]. It's now a little more inefficient since it goes from $-b^2$ to $b^2$ instead of $-|b|$ to $|b|$, including values that $p$ and $q$ could never be, but it saves 4 bytes. a => b => (-b*b to b*b) ...

10

J, 13 7 bytes _&q:inv Try it online! As described here, the verb _ q: n returns the prime exponents of n. So the inverse inv of that verb is exactly what we want.

10

Jelly,  13  11 bytes -2 thanks to Nick Kennedy! (I had a bug in my Python search code so failed to find the hash for a domain of [1..7].) ⁽=ȧ,7ḥⱮḤ’ÆẸ A monadic Link accepting a list of characters that yields the Gödel number. Try it online! How? ⁽=ȧ,7ḥⱮḤ’ÆẸ - Link: list of characters, S ⁽=ȧ - 16481 7 - 7 , - literal pair -> [...

9

Jelly, 5 bytes R×iÆs Try it online! Explanation: - Explanation (sample for input 6) R - Range ([1, 2, 3, 4, 5, 6]) × - Multiply by input ([6, 12, 18, 24, 30, 36]) Æs - Divisor sum (12) i - Index of divisor sum in list, else 0 (2)

9

Husk, 4 bytes ¦¹ΣḊ Try it online! The last test case times out. Explanation ¦¹ΣḊ Input is a number x. Ḋ List of divisors. Σ Sum. ¦ Division if divisible, 0 if not ¹ by x. ¦ is usually just a divisibility test, but here its return value is useful.

9

JavaScript (ES7),  37 36 34  31 bytes Saved 3 bytes thanks to @tsh Expects (a)(b). a=>b=>[b=a/2+(a*a/4-b)**.5,a-b] Try it online!

9

Wolfram Language (Mathematica), 23 21 18 bytes Solve[x x+#2==x#]& Try it online!

9

Ruby, 72 62 57 50 47 bytes 0.step{|x|$*<<p(x)if$*.all?{|i|(x-i)**0.5%1>0}} Try it online! Prints all terms of the sequence indefinitely. 7 bytes saved by Dingus and further 3 by Sisyphus. Ruby 2.7+, 45 bytes 0.step{|x|$*<<p(x)if$*.all?{(x-_1)**0.5%1>0}}

9

Python 3, 67 bytes Takes no input and prints all terms of the sequence with an infinite loop. n,*a=0, while 1:a+=n*(all((n-i)**.5%1for i in a)>0!=print(n)),;n+=1 Try it online!

9

Jelly, 8 bytes ,CÄḤ×ƊS_ Try it online! -2 bytes thanks to Bubbler How it works ,CÄḤ×ƊS_ - Main link. Takes a binary list B on the left C - Complement. Flip the bits of B , - Pair with B: [B, B'] Ɗ - Last 3 links as a monad f([B, B']): Ä - Cumulative sum of each Ḥ - Unhalve × - Multiply modified B by B and ...

9

Jelly, 168 bytes ṫ-;Ṛ×+ƭ/⁸; %@’Ð¿/:ƝṖṚçƒØ.ṫ-××%P{ ’ÆfQ$€m2Ṛż$©f/ÐḟFḢWḟ"Ṛ¥€FḊ$ÐḟZ;FQɗ"ʋ@ƬƲṪF®ḟ€ƑƇẈ⁼Ø1ƊƇƲF€fƇFQɗⱮ`ÐLQƲ,@$ŒPżṚ$F€€;"€ʋ@/;"Ɱ®f"Ẹ¥ÐḟFQɗḟF}ɗŒPżṚ$Ʋ$€Ẏf"ⱮẸ€ẠɗƇ®P€ḤżUƊ$€ẎNÞç¥€⁸FṂ Try it online! A full program taking an integer argument and returning an integer. Works on TIO to solve a for all values of n between 16 and ...

9

Jelly, 20 bytes +Ø.÷€AĊc2ḋIɓN;æl¥ƒ-Ḋ Try it online! Port of my own APL answer. Trailing ɓ chain trick is indeed strong :P How it works +Ø.÷€AĊc2ḋIɓN;æl¥ƒ-Ḋ Dyadic link; left=range, right=divisors xxxxxxxxxxxɓyyyyyyyy x(left, y(right, left)) N;æl¥ƒ-Ḋ y: subset LCMs, negative for even-sized ones N Negate the divisors ...

8

naz, 334 318 316 311 307 bytes Original solution: 2x2v 1x0f0v1s2x0v1v1s2x1v2v3x1v0l 1x1f2v1o 1x4f0v1a2x0v1v1s2x1v2v3x1v4l 1x5f3v2x1v0f2v3x0v5l9v3x2v2g2v 1x3f5v2x0v8v2x9v3v1s2x3v5f0v3x2v1e2v2a3x3v3l8f 1x2f9v1s2x9v0v9a9a9a9a9a9a9a9a9a9a9a1a2x0v5f 1x6f1r8s8s8s8s8s8s 6f2x8v 6f5m2m2x0v 6f2x1v 2v3x1v4l0v2x5v2v2x0v 1x7f5v2x3v1s3x2v1e1s3x2v8e3f 1x8f2v1a1o ...

8

Jelly, 10 bytes ÆEgƒ0:@ƊÆẸ Try it online! ÆE:g/\$ÆẸ errors given 1. ÆE Take the exponents of the input's prime factorization. :@Ɗ Divide each exponent by gƒ0 the exponents' GCD (or 0 in the case that there are none). ÆẸ Let the result be the exponents of the output's prime factorization.

Only top voted, non community-wiki answers of a minimum length are eligible