## python 3.x – Project Euler 8 – Largest product in a series

The four adjacent digits in the 1000-digit number that have the
greatest product are 9 × 9 × 8 × 9 = 5832.

73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
62229893423380308135336276614282806444486645238749
30358907296290491560440772390713810515859307960866
70172427121883998797908792274921901699720888093776
65727333001053367881220235421809751254540594752243
52584907711670556013604839586446706324415722155397
53697817977846174064955149290862569321978468622482
83972241375657056057490261407972968652414535100474
82166370484403199890008895243450658541227588666881
16427171479924442928230863465674813919123162824586
17866458359124566529476545682848912883142607690042
24219022671055626321111109370544217506941658960408
07198403850962455444362981230987879927244284909188
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450

Find the thirteen adjacent digits in the 1000-digit number that have
the greatest product. What is the value of this product?

This is my solution to the problem above.

``````> def largest_product_series(n, series):
>     series = str(series)
>     largest = 0
>     for i in range(0,1000-n):
>         temp = np.prod((int(series(j)) for j in range(i,n+i)))
>         largest = max(temp, largest)
>     return largest
``````

I am having a hard time figuring out what is wrong with my code. It works just fine with n = 4. But somehow it didn’t output the correct answer when n = 13.

Here’s the link to the problem. Euler 8

## algorithms – Finding largest disjoint subtrees spanning nodes

I have a taxonomy (tree) of product categories. To each leaf product category, I have assigned a shop department where the products of a given category can be found.

Now for each department, I would like to find the smallest number of the largest subtrees in the taxonomy.

For instance, in the example below leaf nodes have been assigned one of two departments $$A$$ and $$B$$.

The expected solution would be: $$A$$ has two subtrees, namely $$x_2$$ and $$x_7$$, $$B$$ has one subtree $$x_4$$.

The solution where $$A$$ has $$x_1$$ subtree is wrong because $$x_1$$ is the ancestor of nodes that belong to another department.

The solution where $$A$$ has $$x_3$$ and $$x_7$$ subtrees is wrong because we want the biggest subtrees possible.

Is it a known problem?

Is there a solution for it?

## How to find the locations of Europe’s largest pipe organs?

I’d like to see and hear a range of very good large organs. I like the reverb that occurs in a large church or cathedral, so I would prefer that over a concert hall. Also, since I would like to hear it, I need a location which either has concerts or predictable times when you can hear practice. For example, once I was lucky enough to visit St Paul’s Cathedral in London and happened to hear the organist rehearsing. There are also scheduled recitals, Sunday Organ Recitals, so that is one answer to my question.

Which are the locations of Europe’s largest pipe organs and how can I find them?

I say Europe partly because I am in Europe, but also because I guess that the most impressive organs are here. I am happy to be proved wrong in this assumption.

You may ignore COVID-19. Assume that life eventually returns to normal and what used to be possible becomes possible again.

(The title and text is plural to indicate that I don’t expect a single answer, but a range of recommendations of well regarded organs. I hope that this makes the question less opinion based.)

My interest is musical rather than religious, so I don’t require any specific religion or denomination nor will I reject any. Ideally, I would like recitals unconnected to religious services, but that is not essential. I happy to behave appropriately and respectfully if I need to attend a service.

I am concentrating on cathedral or large church organs rather than the concert hall ones because the experience is quite different.

## seo – Why the LCP (largest contentful paint) value would get worse over time without changes in the site?

I’m not using wordpress, but a LAMP website of my own creation.

For some reason, and without me doing anything on the website, the Largest Contentful Paint values have gotten worse and worse every month from the past year.

I’ve noticed that the website received more and more visitors as well, could that be related? How? Why?

## The world’s largest bitcoin mine support

We have the world’s largest bitcoin mine in Xinjiang, China, covering an area of 500 acres. We have the most complete operation and maintenance team. We guarantee 7 * 24-hour power supply and give you the lowest price discount. If you need, please send an email to btc_ch@outlook.com , we will contact you as soon as possible.

## javascript – Is this an efficient/correct way to get largest Prime factor?

Is this an efficient way to get the largest prime factor of a given number? Other solutions I found involved nested algorithms.

``````function largestPrimeFactor(number) {
const factors = ()
for(let i = 2; i <= number; i++){
if(number % i === 0){
factors.push(i);
number = number / i;
i = 1;
}
}
return factors.pop()
}
``````

## Size of largest square divisor of a random integer

Let $$x$$ be an integer picked uniformly at random from $$1 ldots N$$. Write $$x = r^2 t$$ where $$t$$ is square-free. How does the expected value of $$r$$ scale with $$N$$? Is anything known about the variance of $$r$$?

## Dynamic programming algorithm to find largest triangle in binary square matrix where elements equal “1”

I’m struck how to find DP recurrence for:

You are given a binary square matrix M of size nxn. We define a (p,q, l)-triangle of M, where p >= 1,
q >= 1, L >= 1, p+L >= n+1, and q+L >= n+1, as the set of elements M(i, j) satisfying p =< i < p+L,
q =< j < q+L, and i+ j < p+q+L. Design an algorithm to find the largest (p,q, l)-triangle of M (“largest”
means l is maximized) such that all its elements are “1”

solution:

I think I need to check first if:

element equal 1,

if so, check the element to its left, element in its top and element diagonally if equals “1”

if so increment the result,

but not sure how to put this into recurrence.

## resolution – How can I get the largest MB and highest picture quality from my Panasonic TZ100

I am an amateur (have been for many years) who is trying to take photos of jewellery for poster quality print at A2 size. The image of the jewellery needs to be able to look good at about 1/3 of the size of the poster. I am trying to work at the highest quality resolution and image size, so have experimented with taking images at the L setting as a high quality jpg, and shooting in RAW.
Issues I am coming up against is that, shooting as high quality jpg, the jpgs are ending up at about 3 or max 4MB and as I need to actually crop into the shot image to isolate the jewellery, that’s not good enough resolution.
In RAW, I am having to use the silky pix software to “develop” the RAW files into jpgs. I am not familiar with silkypix, but have ferretted through it and tried to find the options to save at highest resolution – I opted for the photo retouching setting and highest possible quality – and the file is now only 6MB.
I have opted for the TZ100 as I wanted a camera that would hopefully be relatively easy to use – and it comes with a 1inch 20MP sensor… so I thought I would be getting nice big files.
Can anyone suggest a solution? I have read the manual but it doesn’t say anywhere how large the files are that you can save at -just three settings, L, M or S for the jpg sizes, or RAW .
Have I got the wrong camera?
I have been trying to look online for info on the TZ100 but haven’t found any good resources that aren’t more than a basic overview or review.
I am thinking of looking at a photography course as well, but photographing jewellery is SUCH a tricky thing not many courses focus on this sort of thing.

## Best way to find the largest sorted sublist in a list – USACO Sleepy Cow Sorting Python

Solving this problem.

Right now, my solution entails finding the largest sorted sublist, starting from the beginning, all the way to the end. However, I feel like the way I wrote the `sorted_sublist` function can definitely be improved. Besides that, I’m looking for any way to improve the way I write my code.

My code:

``````with open("sleepy.in", "r") as fin:
n = int(next(fin))
nums = (int(i) for i in fin.readline().split())

def sorted_sublist(n, nums):
for i in range(n):
sublist = nums(i:n)
if sublist == sorted(sublist):
return sublist

def main(n, nums):
x = sorted_sublist(n, nums)
return n - len(x)

with open("sleepy.out", "w+") as fout:
print(main(n, nums), file=fout)
``````

Problem synopsis:
Given a list of numbers, find the number of steps it would take to sort this list by repeatedly placing the first element of this list into another slot, provided that you do this in an optimal fashion.

Example:

Input:

``````4
4 3 2 1
``````

Step 1. Place the 4 to the back of the list: 3, 2, 1, 4

Step 2. Place the 3 to the third index of the list: 2, 1, 3, 4

Step 3. Place the 2 to the second index of the list: 1, 2, 3, 4

Output: 3, as it took three optimal steps to reach a sorted list