Questions tagged [number-sequence]

39 questions
36
votes
11 answers

Python's range() analog in Common Lisp

How to create a list of consecutive numbers in Common Lisp? In other words, what is the equivalent of Python's range function in Common Lisp? In Python range(2, 10, 2) returns [2, 4, 6, 8], with first and last arguments being optional. I couldn't…
Mirzhan Irkegulov
  • 17,660
  • 12
  • 105
  • 166
5
votes
6 answers

R - create vector with sequence c(1,4,5,8,9,12,13,16),etc

We are looking to create a vector with the following sequence: 1,4,5,8,9,12,13,16,17,20,21,... Start with 1, then skip 2 numbers, then add 2 numbers, then skip 2 numbers, etc., not going above 2000. We also need the inverse sequence…
Canovice
  • 9,012
  • 22
  • 93
  • 211
4
votes
2 answers

PHP: are rand() pseudo generated numbers always the same for a given seed supplied?

I'm generating a sequence of pseudo random numbers with this code: $seed = 1; srand( $seed ); for($i=0; $i<10; $i++) { echo rand(0,100) . "\n"; } exit(0); The following code outputs always (on my machine) 84 39 79 [....] 77 28 55 Can I rely on…
Paolo
  • 15,233
  • 27
  • 70
  • 91
4
votes
1 answer

Remove every (k+1) th remaining element in kth pass of natural numbers

In the natural numbers series, we've to remove every 2nd element in the 1st pass. Then in the remaining elements, remove every 3rd element in the second pass. Then at Kth pass, remove every (k+1)th element from the remaining elements. The series…
viji
  • 2,706
  • 5
  • 28
  • 34
3
votes
1 answer

Finding all possible sequences

Hi I'm trying to build a function which will walk through all possible number sequences and pass the sequence through a function and if it return true stops. Here is the markup: function sequences($smallest, $biggest, $long, $func) { $seq =…
Shlomi Hassid
  • 6,500
  • 3
  • 27
  • 48
3
votes
2 answers

Determine the third quartile from a collection of integers in C++?

I'm reading Accelerated C++. At the moment I'm at the end of chapter 3 and here's the exercise that I'm trying to do: "Write a program to compute and print the quartiles of a set of integers." I found the first and the second quartiles, but I have…
Windom Earle
  • 648
  • 3
  • 7
  • 21
2
votes
4 answers

Sequence generation/ breadth first searching

Essentially what I'm doing is trying to solve a Rubik's cube with a breadth first search of all possible moves. I know this isn't the best way to solve the cube, but I only need it for very short sequences (so the depth of the search is unlikely to…
1
vote
1 answer

Regular expressions in Dreamweaver - producing a number sequence

I've got an HTML page with a long series of data in tabular format (2194 entries!), each starting with I need each id to be unique, and so would like to use a regular expression in Dreamweaver's find and replace function to do…
1
vote
2 answers

Print numbers that are multiples of certain number uniformly

Maybe a silly question, I am trying to print numbers in a loop in such a way that they are multiples of 10. This is very easy as long as the timestep in the loop is multiple of 10. This is how I do it: time = 0. timestep = 2. while time <= 100.: …
user3412058
  • 315
  • 1
  • 4
  • 13
1
vote
3 answers

gVim insert serial number before each matched pattern using regex

I am using gVim on Windows. I have an XML file with content (extracted) like this:
Oliver Leung
  • 740
  • 5
  • 12
1
vote
3 answers

How can i easily handle numberseries formated with brackets?

I have a long list of numberseries formated like this: ["4450[0-9]", "6148[0-9][0-9]"] I want to make a list from one of those series with single numbers: [44500,44501,..., 44509] i need to do this for many series within the original list and i'm…
sousys
  • 51
  • 6
1
vote
1 answer

How to create a number sequence multicompany?

I need to create a custom number sequence, but another request It is to have a multicompany Number sequence. I know how to create a simple sequence, I used this NumberSeq_Tutorial. It's possible to create a Number sequence in a company, launch the…
ulisses
  • 1,549
  • 3
  • 37
  • 85
1
vote
1 answer

SQL summary of missing numbers in sequence

I would like to find gaps in a sequence and summarize the findings in the following way: number sequence: 2, 3, 4, 8, 9, 12, 13, 14, 15 missing numbers: 0, 1, 5, 6, 7, 10, 11 min number: 0 (always) max number: max number of the sequence (15 in…
janez_007
  • 91
  • 3
  • 13
1
vote
1 answer

Simple numbers sequence prediction using Encog Machine Learning Framework

I am beginner in Java programming and I needed to find some tool for predicting time series in Java. I didn't find anything better than open source Encog framework. It is now quite hard for me to understand some examples(e.g. PredictSunspot.java)…
Amidovka
  • 23
  • 2
1
vote
2 answers

Number sequence for custom table in ax 2012

I have a custom utility which uses a custom table in AX 2012 AOT, I want to have an identity field for my table and someone tell me I can use number sequences for this, and can map a number sequence to my table so it can get a new unique id at the…
alphaprolix
  • 601
  • 2
  • 10
  • 25
1
2 3