## Array manipulation and number theory

How do I rearrange a given array such that the GCD of all the adjacent elements is always 1?

## How to make a CTA for someone who only has a phone number and address?

I’m making a website for a mechanical engineer. All he has is a phone number and an email.

I’m assuming that having a “Contact Us” button would be the most common. But I’m wondering if there is a better way?

Perhaps having a form to fill out and send?

Any suggestions or pointers would be greatly appreciated!

## Calculate the number of combinations of a sequence of numbers in a particular order

I have a problem solving coding challenge when I have to calculate the number of combinations, numbers from 0 to 9, with the length n, with 2 rules –

The first number cannot be 0

Every other number can be 0 or must be divisible by the previous number (number 1 can not be used as divisor), for example [5.0], [1,0] or [2,8], [4,8], [3,6]

For example, if the length n were 2, number of combinations would be 21 – [1,0]…[9,0] + [2,4], [2,6], [2,8], [3,6], [3,9], [4,8] + [2,2]…[9,9]

The resulting response can be code in some programming language or a formula to calculate answer

## What is the maximum number of attacks given the below constraints for AD&D?

A former DM has had the same recurring NPC/GMPC since I started playing in his game. This was 20+ years ago and we started in 1st edition and slowly made our way through the years and editions. We updated our characters as we went to the new editions. Now this NPC/GMPC is the most reviled in his games, any time he shows up all the players immediately want him dead. We stick to character though.

The question will be broken up to hopefully get expert answers from each of the editions in which we played in this particular question it will be specific to 1e. I am skipping 4e (as we all hated it and only played one session) and 5e because I know for a fact that it is not possible there (yet).

The question is as follows:

Give the following constraints what is the maximum number of attacks in this edition:

1. NPC is an Elf (This is just to set the prerequisite for the below multiclass possibility).
2. He was a Thief-Acrobat and I assume multiclassed, probably Fighter-Thief.
3. The weapon of choice was throwing knives.
4. Assume unlimited ammunition as he had a bandalier that had the knives return.
5. I know he could throw 3 knives at a time (pretty sure this was a thing for shuriken from Oriental Adventures).
6. Assume all official sources and Dragon Magazine since the first issue are open.
7. I know of this question and assume there is a variant with knives.
8. If I recall he threw with both hands as well.
9. We were always between 8th and 15th level when I met this character.
10. I do not recall spell-casting but not ruling it out entirely but main build would likely have been focused on mundane means.
11. Assume focused magical item augmentation as well, just calling it out even though the aforementioned bandolier alluded to it, but for the most part official items other than that.

The end result in game was quite literally at least 2 dozen attacks per round, perhaps more. Which I have questioned him multiple times about the build and legitimacy but he as refused to provide any answers. I know DMs do not have to justify but this, combined with a number of other things over the years has lead to distrust. I have since stopped playing his games altogether, so this is just a verification on whether I have overreacted.

This was broken into 3 questions for each of the editions.

## Prove by induction the number of rows in a truth table with n atomic propositions is 2^n

I can barely do a normal proof by induction and i don’t get how I get the proof if I don’t have 2 sides of an equation, Please help!

## Phone Number inputs from 1 string to 3 inputs. Help!

My team is needing to change a phone number object within a form to 3 input fields instead of one string. This is turning out to potentially be slightly challenging for our team on the technical side so I thought I’d reach out to see if anyone has encountered this before or used a phone number widget in lieu of 3 separate inputs to handle country code, area code, and number? It’s clearly not a new problem but it is for my team 🙂

## Regular Expression with at least one a, even number of b

I’ve been working on some regular expression questions, and came across one that I cannot figure out. Working on the language over $$\{a, b\}$$, the text asks for a regular expression for the language of all words having at least one a and an even number of b’s, using only | and * (maybe $$\varepsilon$$ too). My idea so far has been something like $$(a^*ba^*b)^*a^*a(a^*ba^*b)^*a^*$$, but this doesn’t match cases like bab, bbbab, or baaab.

## Returning Social Security Number After Validation Checks on Web Based Form

I have a web based application form that is used to gather personal information for web based users. One of the fields is an SSN. My question is simple, in terms of security compliance (in general, OWASP, PCI, SOC2, etc), is it okay to prefill the SSN when the user is returned to the form because of validation issues?

For instance, say I fill out the entire form, I forgot to enter Birth Date (another field on the form), the form reload the page, displays a validation message related to a required field birth date, the form is then populated with the form fields the user already entered, First Name, Last Name, SSN, etc. Is it acceptable in terms of security compliance to repopulate their SSN (this is coming from the server side validation, not client side), or should I force the user to re-enter their SSN?

## Find $n’th$ perfect number , where perfect number is a positive integer whose sum of digits is $10$

For example $$46$$ is a perfect number , since $$4+6=10$$ . If $$n=1$$ , answer is $$19$$. If $$n=2$$ , answer is $$28$$. If $$n=3$$ , answer is $$37$$ and so on .We need to make a program which takes $$n$$ and outputs $$n’th$$ perfect number.

How to solve this problem for large $$n$$ , for example $$n$$ close to $$10^{18}$$ ? we can’t use brute force method since input can be so large .Can we solve it using DP or binary search ?

Source of the problem : Perfect Number

Note: In given problem statement (in link) $$n$$ is not large and thus can be solved using brute force.But i am curious to solve it for large $$n$$.

## How to build a machine that enumerates language L=0^2n, n is natural number?

I don’t know how to build an enumerator G such that L(G)={0^2n, n is natural number}. I have constructed turing machine for given language:

(A is accept, R is reject)

I don’t know how can I use this machine to make language enumerator (to print strings ,00, 0000, 000000,…). I can’t find any examples or algorithms for finding enumerator for given language.