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

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Hostile Divisor Numbers

Some divisors of positive integers really hate each other and they don't like to share one or more common digits.

Those integers are called Hostile Divisor Numbers (HDN)

Examples

Number 9566 has 4 divisors: 1, 2, 4783 and 9566
(as you can see, no two of them share the same digit).
Thus, 9566 is a Hostile Divisor Number

Number 9567 is NOT HDN because its divisors (1, 3, 9, 1063, 3189, 9567) share some common digits.

Here are the first few HDN

1,2,3,4,5,6,7,8,9,23,27,29,37,43,47,49,53,59,67,73,79,83,86,87,89,97,223,227,229,233,239,257,263,267,269,277,283,293,307,337... 


Task

The above list goes on and your task is to find the nth HDN

Input

A positive integer n from 1 to 4000

Output

The nth HDN

Test Cases

here are some 1-indexed test cases.
Please state which indexing system you use in your answer to avoid confusion.

input -> output 
 1 1 
 10 23 
 101 853 
 1012 26053 
 3098 66686 
 4000 85009 

This is , so the lowest score in bytes wins.

EDIT

Good news! I submitted my sequence to OEIS and...
Hostile Divisor Numbers are now OEIS A307636

Answer*

Draft saved
Draft discarded
Cancel
9
  • \$\begingroup\$ Can you please add a TIO link so that everybody can check your answer? \$\endgroup\$ Commented May 3, 2019 at 16:40
  • \$\begingroup\$ 95 bytes: (n=t=1;While[t<=#,If[!Or@@IntersectingQ@@@Subsets[IntegerDigits@Divisors@n,{2}],t++];n++];n-1)& I am not planning to post an answer so I will leave this here \$\endgroup\$ Commented May 3, 2019 at 16:45
  • \$\begingroup\$ @J42161217, I've been trying to get the code to work in TIO without success. There must be some trick I'm missing. \$\endgroup\$ Commented May 3, 2019 at 20:55
  • \$\begingroup\$ @J42161217, Your code seems to work but takes 3 times the runtime. You can submit it as your own. (Maybe I'll learn how to implement TIO from your example.) \$\endgroup\$ Commented May 3, 2019 at 20:57
  • 1
    \$\begingroup\$ 72 bytes using For instead of While, E!=##& to test for repeated digits \$\endgroup\$ Commented May 3, 2019 at 22:23

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