Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 11 characters in body
Source Link
ZaMoC
  • 25.5k
  • 2
  • 32
  • 87

Wolfram Language (Mathematica), 8969 bytes

Takes a positive integer n and outputs all n-sociable sequences

Do[If[Last[s=NestList[Tr@Divisors@#Do[NestList[Tr@Divisors@#-#&,d,#]]==d&&Tr[1^Union@s]==##]/.{a__,Print@Most@s]d}/;0!=a:>Print@{a},{d,∞}]&

Try it online! Try it online!

-20 bytes thanks to @att

Wolfram Language (Mathematica), 89 bytes

Takes a positive integer n and outputs all n-sociable sequences

Do[If[Last[s=NestList[Tr@Divisors@#-#&,d,#]]==d&&Tr[1^Union@s]==#,Print@Most@s],{d,∞}]&

Try it online!

Wolfram Language (Mathematica), 69 bytes

Takes a positive integer n and outputs all n-sociable sequences

Do[NestList[Tr@Divisors@#-#&,d,#]/.{a__,d}/;0!=a:>Print@{a},{d,∞}]&

Try it online!

-20 bytes thanks to @att

Source Link
ZaMoC
  • 25.5k
  • 2
  • 32
  • 87

Wolfram Language (Mathematica), 89 bytes

Takes a positive integer n and outputs all n-sociable sequences

Do[If[Last[s=NestList[Tr@Divisors@#-#&,d,#]]==d&&Tr[1^Union@s]==#,Print@Most@s],{d,∞}]&

Try it online!

AltStyle によって変換されたページ (->オリジナル) /