Questions tagged [sequences]

A sequence is any type for which there is a bijective relation between the integers `0..n` and the elements of the sequence, and the elements may be accessed in the order `0..n`, where `n` is the number of elements in the sequence.

A sequence is any type for which there is a bijective relation between the integers 0..n and the elements of the sequence, and the elements may be accessed in the order 0..n, where n is the number of elements in the sequence.

A sequence may be infinite, in which case, the relation is with the open range 0....

538 questions
-2
votes
1 answer

How to find if an array of numbers is a geometric sequence in javascript

I don't know where to start with this. Am I missing some knowledge I would need to know? Any hints you could give me or a solution I could dissect?
user2562240
  • 49
  • 1
  • 3
-3
votes
2 answers

Troubleshoot simple summation function

I want to create f(n) for Sn = n(n+1)/2. Does this make sense? I feel like a nerd! Here's what I wrote: def f(x): sum=n(n+1)/2 print(sum)
-3
votes
1 answer

How to make random sequences from array elements?

I made an array containing 24 elements. I want to iterate a loop 24 times, each time taking all the elements from the array and making a unique sequence. For example: for(int i=0; i<4 ; i++) array = [a,b,c,d] The output I want is: iteration1:…
-3
votes
1 answer

Javascript sequences with an array of function calls

sequence( start, step ) This function takes two numeric inputs, start and stop, and returns a function of no inputs. The resulting function will generate a sequence of values beginning with start and offset by step Each function call will generate…
-3
votes
2 answers

Number of subsequences of a string with K distinct characters

I want to solve a problem and I need some help because my code doesn't work. Ok, so I have a sequence S(input data) and I need to find the number of subsequences such that a subsequence number of distinct characters must be equal with K (input…
Vader
  • 111
  • 1
  • 2
  • 7
-3
votes
1 answer

SEQUENCE: The general formula

Please, can anyone help me get the general formula of the sequence below. when n=3 the number of arrows is 2 when n=4 the number of arrows is 4 when n=5 the number of arrows is 8 when n=6 the number of arrows is 12 when n=7 the number of arrows is…
babs
  • 31
  • 6
-3
votes
1 answer

how can i modifty this code to print the following sequence?

public class ArrayR71A { public static void main(String [] args) { int[] myNums = new int[10]; for (int i = 0; i < myNums.length; i++) { myNums[i] = i + 1; System.out.print(myNums[i] + " "); } …
Manuel Buenrostro
  • 121
  • 1
  • 2
  • 5
-4
votes
3 answers

write in capital letters?

i have the next code: bestand = open("6_frame.txt", "r") seq = bestand.readlines() #to make a list for line in seq: alle = line while True: if alle.isupper(): break else: …
Emine Poyraz
  • 37
  • 1
  • 8
-4
votes
5 answers

Can't find a way to write a sequence 1,2,3,4,..,K,1,2,3,...,K, where K is user entered number

This is the loop. for(m=0; m<10; m++){ for (i=0; i<=K; i++) { A[i] = i; } } And this is print code. System.out.println("A:"); for (i=0; i<20; i++) { System.out.printf("%.1s\t", A[i]); if (i==9)…
-4
votes
2 answers

Find Most Frequent Character(s) in any sequence(list, string, tuple) in python 3+ with for loop

question: 10. Most Frequent Character Write a program that lets the user enter a string and displays the character that appears most frequently in the string. This is an answer for those who are studying intro to cs with "Starting out with Python"…
Denys
  • 114
  • 1
  • 6
-4
votes
1 answer

In versions of JS upto and including ES6 are there any mechanisms available for the generation of sequences without loops or recursion?

In versions of JS upto and including ES6 are there any mechanisms available for the generation of sequences without loops or recursion? For example: [n, n*2...] // Hypothetical syntax that I know to be invalid JavaScript
Ben Aston
  • 53,718
  • 65
  • 205
  • 331
-6
votes
3 answers

how to reverse a sequence

my table EMP_NO EMP_NAME ---------------------- ---------- 1 ram 2 mohan 3 raju 4 santosh 5 nikil …
user2775287
  • 17
  • 1
  • 2
  • 6
-8
votes
3 answers

Logic to generate an alphabetical sequence in C#

The sequence should go like this. A-Z,AA-AZ,BA-BZ,CA-CZ,.......,ZA-ZZ After ZZ it should start from AAA. Then AAA to ZZZ and then AAAA to ZZZZ and so on. This sequence is pretty much like that of an Excel sheet. Edit: Added my code private…
1 2 3
35
36