Computer Science, asked by BrainlyProgrammer, 3 months ago

New Question!!!

Write a python/Java códe for folloowing series:-
I) 4 6 12 18 30 42 60 72 102 108...nth term
ii) 6 14 36 98 276...nth term
_
• Try not to spam and not to copy other's answer :)​

Answers

Answered by Oreki
6

\textsf{\large\textbf{I.}}

   \text{N\textsuperscript{th} term of the series is given by,}\\\textsf{\hspace{1em} Average of n\textsuperscript{th} Twin Prime Pair \textit{or,}}\\\text{\hspace{1em} Letting the twin primes be \texttt{p} and \texttt{p + 2} so, the term will be \texttt{p + 1}.}

   \textsf{\textbf{C\symbol{111}de}}\\

       \texttt{d\symbol{101}f is\_prime(number):}\\\texttt{\hspace{1em} for i in range(2, number):}\\\texttt{\hspace{2em} if number \% i == 0:}\\\texttt{\hspace{3em} return False}\\\texttt{\hspace{1em} return True}\\\\\texttt{count, i, N = 0, 3, int(\symbol{105}nput("Enter N - "))}\\\texttt{while count != N:}\\\texttt{\hspace{1em} if is\_prime(i) and is\_prime(i + 2):}\\\texttt{\hspace{2em} print(i + 1, end=" ")}\\\texttt{\hspace{2em} count += count}\\\texttt{\hspace{1em} i += 2}

\textsf{\large\textbf{II.}}

    \text{N\textsuperscript{th} term of the series is given by,}\\ \textsf{\:\:\: a(n) = 1\textsuperscript{n} + 2\textsuperscript{n} + 3\textsuperscript{n} \textit{\:\: or,}}\\\textsf{\:\:\: a(n) = 1 + 2\textsuperscript{n} + 3\textsuperscript{n}}\\\\

    \textsf{\textbf{C\symbol{111}de}}\\

        \texttt{\# Detailed}\\\texttt{d\symbol{101}f nth\_term(n):}\\\texttt{\hspace{1em} return 1 + 2 *\symbol{42} n + 3 *\symbol{42} n}\\\\\texttt{for i in range(1, int(\symbol{105}nput("Enter N - "))):}\\\texttt{\hspace{1em} print(nth\_term(i), end=" ")}  

Attachments:
Answered by Itzunknownhuman
2

(☞゚∀゚)☞Answer:-

It’s a geometric sequence of common ratio 2; so each term in this sequence is multiplied by 2 to reach the following one:

3×2=6

6×2=12

12×2=24

24×2=48

48×2=96

And so on…

We can see it from another way if we write this sequence (denoted by Un later) in terms of n; where its first term U0=3 and its common ratio r=2:

Un=U0×r^(n)

The following term is the 5th then:

U5=U0×r^(5)=3×2^(5)=96

please make me brainlest for my hard work

Similar questions