Predict your next investment

CONSUMER PRODUCTS & SERVICES
pandigital.net

See what CB Insights has to offer

Founded Year

1998

About Pandigital

Privately held, Pandigital develops and markets digital entertainment products. The company recognizes the growing digital lifestyle market in the U.S. as well as the convergence of media such as MP3, digital photos and digital video a

Pandigital Headquarter Location

6300 Village Parkway

Dublin, California, 94568,

United States

925-833-7898

Latest Pandigital News

Project Euler # 43 in JavaScript — Sub-String Divisiblity in Pandigital Numbers.

Jan 20, 2018

Graphic Designer. Blogger. React Enthusiast. NodeJs Addict. MongoDB Freak. Email: ethan.jarrell@gmail.com Jan 19 Project Euler # 43 in JavaScript — Sub-String Divisiblity in Pandigital Numbers. I finished #43 from projecteuler.net. I’m going to walk through my process here of how I came to the solution. Fair warning however, I am not a mathematician. I’m barely a decent programmer, but definitely not a mathematician. As I was doing this problem, it became evidently clear that my ineptitude at math is definitely a stumbling block when it comes to problems like these. So most of my solutions are absolutely the “brute force” approach for that reason. Anyway, with that out of the way, Here’s the problem: The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property. Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we note the following: d2d3d4=406 is divisible by 2 d3d4d5=063 is divisible by 3 d4d5d6=635 is divisible by 5 d5d6d7=357 is divisible by 7 d6d7d8=572 is divisible by 11 d7d8d9=728 is divisible by 13 d8d9d10=289 is divisible by 17 Find the sum of all 0 to 9 pandigital numbers with this property. So here’s the way I thought of this. For better or worse, I looked at this as a problem where, instead of one long 10 digit number, what I was really looking at was a series of 3 digit numbers. In the example below, the first group [460] would need to be divisible by 2 in order to meet the criteria. Then the second group, [603] would need to be divisible by 3 in order to meet the criteria, and so on and so forth. My thought was that I could simply grab all of the numbers between 100 and 999, and test each number to see if it was divisible by 2, 3, 5, 7, etc. But then I realized I needed to modify my search because just getting the numbers between 100 and 999 isn’t all I needed. I also needed numbers that started with 0. Take the following for example: If I’m getting all the numbers between 100 and 999, and I’m at, for example, 258. There’s no reason to modify this digit. If 2 is a, 5 is b, and 8 is c, I don’t also need the combination bca and cba, because simply continuing up to 999 will also grab both of those. However, it would not grab some of these: If the current number I’m grabbing is 300, my current method won’t also get 003 or 030. Or, if I’m on 205, I wouldn’t also get 052, but I would get 502. Then I realized that the pandigital numbers don’t repeat or duplicate any digits. So in the middle example, I wouldn’t need 300, 003 or 030, since it repeats the 0 twice. In the bottom example I would need 052, but 502 would already be part of my method, so no modification there either. In these examples, the only combinations of letters I need are “abc” and “bca”, but only “bca” if the middle digit is 0. Here’s how that part of my code looks: let numbersToTest = []; let str = i.toString(); } What I did was loop over the numbers 100 to 999. I turn it into a string, split it, and convert each array element back into a number. Then I have combo1 and combo2. if b is 0, I push combo3, and if b isn’t 0, I push combo1. I also don’t want a, b, or c to be equal to each other, to avoid duplicates, so if any of them do equal each other, they don’t get pushed at all. I end up with all the 3 digit combinations that have only unique digit combinations between 100 and 999. Now, I realize that there are two different things I need to test for in each combination. First, I need to figure out whether it’s divisible by a given number, ie, 2, 3, 5, 7, 11, 13, or 17. But, look again at this chart: Since I now have these in groups of 3, I’m eventually going to smoosh them together and create a 10 digit number. However, in the first group here [460], the second and third digit of this group are equal to the first and second digit of the next group [603], and so on. So as I go through each group of 3, I need to test whether or not it’s divisible by a certain number, and also see if the digits match the digits in the previous group. If it’s not divisible by the number I’m looking for, or the numbers aren’t a match, I will discard it. What I set out to do, was start with an array of all “x”s. Then, as I loop through my array of numbers to test, if the group is divisible by 2, then I push those three digits into my array of “x’s and replace and x with a number from that array. In my head, it should look like this: Then I should have the same array I had before, but just with x’s along with the 3 digit numbers divisible by 2 occupying the 2nd, 3rd and 4th space in the array. My code looks something like this: let testArr2 = []; let testArr1 = ["x","x","x","x","x","x","x","x","x","x"]; let number = parseInt(numbersJoin); Now, what I’m thinking is that I can cycle through each array like this: I would be checking to see if index 2 and 3 of array1, and index 2 and 3 of array2 match. If there’s a match, I create a new array, including the first number from array1, and the last number from array2. Then, I would do the same thing, comparing the new array, with the array of numbers divisible by 5, like so: With each loop, I would add one digit onto my magical set of numbers. Here’s the actual JavaScript code, using nested for loops to make each match. let finalArr9 = []; for (var k = 0; k < testArr3.length; k++) { let tempArr = ["x","x","x","x","x","x","x","x","x","x"]; testArr2[i][3] == testArr3[k][3]){ tempArr[1] = testArr2[i][1]; tempArr[2] = testArr2[i][2]; tempArr[3] = testArr2[i][3]; tempArr[4] = testArr3[k][4]; finalArr9.push(tempArr); } At this point, I should have all of my arrays, completely full of numbers, except for the first digit, so I loop through all my new arrays, and I find out which digit of 0–9 is missing, and add that digit to index 1 of the array. let finalArr15 = []; let tempArr = ["x","x","x","x","x","x","x","x","x","x"]; tempArr[2] = finalArr14[i][2]; tempArr[3] = finalArr14[i][3]; tempArr[4] = finalArr14[i][4]; tempArr[5] = finalArr14[i][5]; tempArr[6] = finalArr14[i][6]; tempArr[7] = finalArr14[i][7]; tempArr[8] = finalArr14[i][8]; tempArr[9] = finalArr14[i][9]; if (finalArr14[i].includes(0)==false){ tempArr[0] = 0; [4, 1, 0, 6, 3, 5, 7, 2, 8, 9] [4, 1, 3, 0, 9, 5, 2, 8, 6, 7] [4, 1, 6, 0, 3, 5, 7, 2, 8, 9] [1, 4, 0, 6, 3, 5, 7, 2, 8, 9] [1, 4, 3, 0, 9, 5, 2, 8, 6, 7] [1, 4, 6, 0, 3, 5, 7, 2, 8, 9] Then, it’s simply a matter of converting the arrays back to numbers, and adding them together. My solution: 16695334890 I know this is by far not the best solution, but, for a not mathematician, I think I did okay. I’m going to go give myself a bit pat on the back, drink an ice cold root beer, and eat a half pint of ice cream.

Predict your next investment

The CB Insights tech market intelligence platform analyzes millions of data points on venture capital, startups, patents , partnerships and news mentions to help you see tomorrow's opportunities, today.

Pandigital Patents

Pandigital has filed 3 patents.

patents chart

Application Date

Grant Date

Title

Related Topics

Status

11/23/2010

5/24/2011

Grant

00/00/0000

00/00/0000

Subscribe to see more

Subscribe to see more

Subscribe to see more

00/00/0000

00/00/0000

Subscribe to see more

Subscribe to see more

Subscribe to see more

Application Date

11/23/2010

00/00/0000

00/00/0000

Grant Date

5/24/2011

00/00/0000

00/00/0000

Title

Subscribe to see more

Subscribe to see more

Related Topics

Subscribe to see more

Subscribe to see more

Status

Grant

Subscribe to see more

Subscribe to see more

Pandigital Web Traffic

Rank
Page Views per User (PVPU)
Page Views per Million (PVPM)
Reach per Million (RPM)
CBI Logo

Pandigital Rank

CB Insights uses Cookies

CBI websites generally use certain cookies to enable better interactions with our sites and services. Use of these cookies, which may be stored on your device, permits us to improve and customize your experience. You can read more about your cookie choices at our privacy policy here. By continuing to use this site you are consenting to these choices.