## How to apply Python generators to finding min and max values?

I’m solving yet another problem in HackerRank (https://www.hackerrank.com/challenges/determining-dna-health/problem). In short: you are given 2 arrays (`genes` and `health`), one of which have a ‘gene’ name, and the other – ‘gene’ weight (aka health). You then given a bunch of strings, each containing values `m` and `n`, which denote the start and end of the slice to be applied to the `genes` and `health` arrays, and the ‘gene’-string, for which we need to determine healthiness. Then we need to return health-values for the most and the least healthy strings.

My solution is below, and it works, but it’s not scalable, i.e. it fails testcases with a lot of values.

``````import re
if __name__ == '__main__':
n = int(input())

genes = input().rstrip().split()

health = list(map(int, input().rstrip().split()))

s = int(input())
weights = ()
for s_itr in range(s):
m,n,gn = input().split()
weight = 0
for i in range(int(m),int(n)+1):
if genes(i) in gn:
compilt = "r'(?=("+genes(i)+"))'"
matches = len(re.findall(eval(compilt), gn))
weight += health(i)*matches
weights.append(weight)
print(min(weights), max(weights))
``````

Can you advise on how to apply generators here? I suspect that the solution fails because of the very big list that’s being assembled. Is there a way to get min and max values here without collecting them all?

Example values:

``````genes = ('a', 'b', 'c', 'aa', 'd', 'b')
health = (1, 2, 3, 4, 5, 6)
gene1 = "1 5 caaab" (result = 19 = max)
gene2 = "0 4 xyz" (result = 0 = min)
gene3 = "2 4 bcdybc" (result = 11)
``````

This case returns `0 19`

## nt.number theory – Calculate generators from \$ Gamma_0 (N) \$

I found the group in a newspaper $$Gamma_0 (18)$$ can be generated by the following list of matrices:

• $$displaystyle left ( begin {array} {rr} 7 & -1 \ 36 & 5 end {array} right)$$

• $$displaystyle left ( begin {array} {rr} 13 & -8 \ 18 & -11 end {array} right)$$

• $$displaystyle left ( begin {array} {rr} 71 & -15 \ 90 & -9 end {array} right)$$

• $$displaystyle left ( begin {array} {rr} 55 & -13 \ 72 & -17 end {array} right)$$
• $$displaystyle left ( begin {array} {rr} 7 & -2 \ 18 & -5 end {array} right)$$
• $$displaystyle left ( begin {array} {rr} 31 & -25 \ 36 & -29 end {array} right)$$
• $$displaystyle left ( begin {array} {rr} 1 & 1 \ 0 & 1 end {array} right)$$
• $$displaystyle left ( begin {array} {rr} -1 & 0 \ 0 & -1 end {array} right)$$

E.g. $$31 times (-29) – 36 times (-25) = -899 + 900 = 1$$ Actually, $$36, 18, 19 equiv 0 pmod {18}$$.

These generators look anything. There is a list of generators from $$Gamma_0 (N)$$ to the $$N <100$$ ?

Is there a computer program or algorithm for finding generators of congruence groups, for example using a linear algebra package such as e.g. `sage` ?

## BLOGGER Online landing pages for gift card generators for CPA offers for USD 10

#### BLOGGER Online landing pages for gift card generators for CPA offers

Hi there.
You no longer have to buy a domain name or hosting to advertise your cpa offers.
With the help of the professional BLOGGER landing pages, you can advertise your CPA offers 100% free of charge.
I will give you the best, most professional and best converted landing page for BLOGGER. Available landing pages: # 1. Facebook gift card online generator.
# 2. Amazon gift card online generator.
# 3. Google Play gift card online generator.
# 4. Steam gift card online generator.
# 5. Xbox gift card online generator.
# 6. iTunes gift card online generator.
# 7. Online generator for PlayStation gift cards.
# 8. Online generator for Ebay gift cards. I will guide you step by step to setting up your blogger. Please contact me for further information. Thank you very much.

## How to create an XML sitemap without XML sitemap generators

Hello everybody. I am currently trying to work on my website.

How does the XML language work? Is it basically HTML, but different?

I was looking for … | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1796424&goto=newpost

## rational points – Two additional generators are required for an elliptical Z / 6 curve

We are looking for rank 8 elliptic curves with the torsion subgroup Z / 6 using newly discovered families that are similar to Kihara (Kihara family is described in https://arxiv.org/pdf/1503.03667.pdf).

Today we came across a curve

$$(0.8169768624655967629114128598.0, -451787550647310420612086468536366715869054405951830599.0)$$

Both Magma Calculator (http://magma.maths.usyd.edu.au/calc/) and mwrank with $$-b12$$ Return 6 generators for this curve.
Magma V2.20-10 (STUDENT) no longer has enough memory to run the following code:

``````SetClassGroupBounds("GRH");
E := EllipticCurve((0,8169768624655967629114128598,0,-451787550647310420612086468536366715869054405951830599,0));
MordellWeilShaInformation(E);
``````

Sagemath returns $$8$$ for the upper limit of the analytical rank, also for max_Delta =$$3.3$$ (We are still testing for a higher max_Delta):

``````E = EllipticCurve((0,8169768624655967629114128598,0,-451787550647310420612086468536366715869054405951830599,0))
E.analytic_rank_upper_bound(max_Delta=3.3,root_number="compute")
``````

Is there a way to find two more generators?

A similar question for that $$6$$ <= Rank (E) <= $$7$$ The situation has been successfully resolved by Jeremy Rouse (another elliptical Z / 6 curve generator required), but our software throttles when we try to follow his instructions.

We are ready to award a bounty from a $$100$$ (How do I transfer my current call?) For both generators. Your name (together with ours) will also be published at the end of the page here: https://web.math.pmf.unizg.hr/~duje/tors/z6.html

Max