Questions tagged [integer-sequence]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
153 views

Finding recurrence formulas from procedural code and output lists associated with integer sequences

This code outputs 37 sequences and takes about 15-minutes to run. I would like to be able to see how many and which variables { i, j, k, m, n } each of the 37 ...
3
votes
2answers
164 views

solve for two variables for each n related to Collatz conjecture

For this code, for each x I would like to solve for all value ranges for c1 and c2 in a bounded range ie c1 and c2 in the range of real numbers +-100 for c1 and c2 for each x, which combined give "...
8
votes
5answers
294 views

Return last number in sub-sequences in a list of integers

Given a list of integers like this: z = {113, 117, 118, 119, 120, 121, 475, 476, 529, 538, 542, 543, 544} I want a function that returns: ...
21
votes
4answers
938 views

Generate and graph the Recamán Sequence

I was surprised to see that we don't have any posts that mention the Recamán Sequence, so I figured I should post it as a challenge. By definition, $a_0=0$ and $a_n=a_{n-1}-n$ if the r.h.s. is ...
1
vote
0answers
101 views

Integer sequence and RAM limits

I am trying to calculate the set of unique differences in a sequence, however the sequence grows fast and I hit the RAM limit of my PC for nthPrimeToUse = 11. For nthPrimeToUse 1 to 10 the output of ...
6
votes
4answers
836 views

RandomInteger with equal number of 1 and -1

I want to generate a list of random integers with only three values 1,0,-1. I know it can be done through RandomInteger[{-1, 1}, n]. How can I impose constraint on this list so that every integers in ...
2
votes
2answers
95 views

Mathematica analog to Wolfram|Alpha dataset analysis [closed]

I have a set of sequences with length 8,48,480,5760,.. and would like to do sequence analysis on them. I plugged the length 8 sequence into wolframalpha: https://www.wolframalpha.com/input/?i=11,+2,+...
24
votes
3answers
566 views

Speeding up the built-in Rudin-Shapiro and Thue-Morse sequence functions

Version 10.2 introduced two well-studied sequences as functions: the (Golay-)Rudin-Shapiro sequence (RudinShapiro[]) and the (Prouhet-)Thue-Morse sequence (...
1
vote
0answers
34 views

Find all integer tuples in a bounded region

For given rational numbers $p_1/q_1,p_2/q_2,p_3/q_3$ and a negative integer $d$, I'd like to find quadruples of integers $(w,x,y,z)$ in a rectangle(of particular sidelengths) satisfying the series of ...
3
votes
1answer
62 views

FindGeneratingFunction gives up too easily [closed]

I am trying to automatically find a generating function from the coefficients of a simple rational function using Mathematica's FindGeneratingFunction: ...
5
votes
1answer
58 views

The next element can be obtained using Predict or SequencePredict?

I want to estimate the next number with the data of the sequence listed as elements 0 and 1. For example, when data = {0,0,1,1,0,0,1,0,0,1,1,0,0,1} (actually, ...
3
votes
1answer
84 views

how to obtain these increasing integers for given n and m?

Let n and m be natural numbers. Then, how does one write a function ordint[n,m] that gives ...
9
votes
2answers
667 views

How to construct rectangular figures from the Fibonacci numbers?

How do you construct rectangular figures using the Fibonacci numbers in Mathematica using graphics? I know that the basis of the construction of these figures are the formulae for summing the terms, ...
2
votes
1answer
118 views

Constructing the following figure using mathematica

How do I construct the figure in the image using the formulae in Mathematica? I defined the following functions for the 4 cases. Can you also explain the significance of these in relation to the ...
0
votes
1answer
65 views

How to postulate a formula for the following Mathematica function

I am using Mathematica to explore the properties of the Fibonacci Sequence. Below is the functions I have defined ...
3
votes
1answer
98 views

Guess Diophantine equation from its solutions

Take for example the equation $$ n^2=x^2+y^2+1 $$ where $x,y$ are integers. This equation admits solutions only for some values of $n$, to wit, $$ n=1,3,9,17,19,33,35,51,73,81,99,\dots $$ Can we ...
1
vote
1answer
82 views

Is there a way to exclude certain numbers in a sequence?

For example, the sequence of triangular numbers can be expressed as $1/2 [n (n + 1)]$ with $n=1,2,3,4,...$ but is it possible to create a summation of everything remaining $(2,4,5,7,8,9,11,12,13,14,......
48
votes
8answers
2k views

Is it possible to invoke the OEIS from Mathematica?

I had always wondered if there might be a way to write a function, which I'll call OEISData[], that more or less works as a curated data function for The On-Line ...
5
votes
3answers
112 views

How to find a list of values of recurrence equation?

I tried with RSolve,but it fails: RSolve[{x[n + 1] == n + Sum[j*x[j], {j, 1, n}], x[1] == 1}, x[n], n] Returns unevaluated ...
11
votes
3answers
4k views

Easier program for period of Fibonacci sequence modulo p

For a little project I need to calculate the period of a Fibonacci sequence modulo p, for which p is a prime number. For example, the Fibonacci sequence modulo 19 would be: $$0, 1, 1, 2, 3, 5, 8, 13, ...
2
votes
3answers
144 views

Finding the largest palindrome which is the product of two 2-digit numbers

My goal is to find the largest palindrome which is the product of two 2-digit numbers using the following program. I want the program to add each palindrome it finds, to the list H. I also want it to ...
0
votes
1answer
49 views

A problem of a sequence and its sum

{a(n)} is such a sequence, satisfying, For all a(i) ∈ {a(n)}, a(i) =1 or -1 Let S(j) = Sum[a(i) , {i ,1, j}], then for all 1<=j<=n ,S(j)>=0. For a given n , how many {a(n)} are there?
1
vote
1answer
59 views

How to perform this indefinite sum?

The following indefinite sum with (CC[n]=1 for even n and CC[n]=i for odd n) ...
2
votes
2answers
388 views

splitting integer problem

I want to cut the integer into small numbers and show me all the possibilities. For example, if I choose integer 6, then I would like to know how many combination of a 5 dimensional vector (or table ?)...
6
votes
2answers
93 views

Selecting integers which are not a member in an ordered list of integers

I have an ordered list of integers, i.e.: list = {1,3,5,6,8,10,12,15}; and I want to know if there is a fast way to get a list of the integers that do not appear ...
9
votes
5answers
660 views

How to tell Mathematica to do this with decimal part of real number?

My apologies if this was asked here before. My friend and I want to do this: Suppose that we have some real number $a. a_1 a_2...a_n...$ where $a_i$ are digits in the set $\{1,2,3,4,5,6,7,8,9,0\}$ (...
1
vote
0answers
54 views

Coefficients of polynomials forming an unimodal sequence

Let $f(x)=\sum_{i=0}^{n}a_{i}x^{i}$ be a polynomial with rational coefficients. I am interested in an efficient way which allows checking whether the finite sequence $A=(a_{i})_{i\in\{0,\ldots,n\}}$ ...
0
votes
2answers
353 views

How do I graph only integers using the list function?

I have plotted the following function using the following code: ...
2
votes
1answer
113 views

efficiently method for generating a sequence

The sequence is defined as $a(1)=1,a(n)=a(n-1)+a\left(\left\lfloor \log _2(n)\right\rfloor \right)$ A natural way do this is ...
3
votes
1answer
532 views

Evaluate large Fibonacci numbers

I want to evaluate that Fibonacci[28143753246]. However the result is OverFlow[]. Is there any way to evaluate it? Thank you.
0
votes
0answers
64 views

PARI to Mathematica conversion

I need to use the coefficients T(n,k) in my algorithm and I found a program in PARI Can anybody translate this code to mathematica? ...
1
vote
1answer
223 views

How to define amazing Goodstein's sequence?

There is an amazing and counterintuitive theorem: For all $n$, there exists a $k$ such that the $k$-th term of the Goodstein sequence $G_k(n)=0$. In other words, every Goodstein sequence ...
2
votes
2answers
88 views

Producing a particular sequence of integers recursively [closed]

I am supposed to write a function which computes the next integer in a sequence from the given one. For example: nextval[57] should give mm ...
9
votes
5answers
15k views

How to detect if a sequence of integers is consecutive

I'm not a math-guy really (a programmer actually) and this is my first question. And excuse me if I can not explain my problem good. The problem is I have a sequence of integers and I want to detect ...
3
votes
1answer
151 views

How many terms does FindSequenceFunction need to discover a simple polynomial rule?

Consider a simple sequence starting with seq1 = {429, 1014, 1935, 3264, 5073, 7434, 10419, 14100, 18549, 23838}; We are looking for a rule (of course there ...
20
votes
3answers
834 views

Partitioning a number into consecutive integers

Consider n=45; then $$1+2+3+4+5+6+7+8+9=45$$ $$5+6+7+8+9+10=45$$ $$7+8+9+10+11=45$$ $$14+15+16=45$$ $$22+23=45$$ Question: how to find all representations of a ...
11
votes
4answers
3k views

How to implement recursive function

I'm trying to do the following (taken from an answer by Watson to my question on Math SE): Start with $x_1=2$, say. Then define $$x_{n+1} = |\{i \in \{1,\dots,n-1\} \;:\; x_i=x_n\}|$$ i.e. number ...
1
vote
2answers
384 views

Generate the Fibonacci sequence with Accumulate

Is there a way to generate the Fibonacci sequence with the Accumulate function?
1
vote
1answer
84 views

Why does the FindSequenceFunction command sometimes succeed with subsequences, while failing for the longer sequences?

I've encountered this phenomenon a number of times--and can provide specific examples if requested. For example, I have a 75-long sequence of rational numbers for which the FindSequenceFunction fails ...
6
votes
1answer
108 views

Are there different Method options that can be used with FindSequenceFunction?

The help page states that Method is an option to use with FindSequenceFunction, but I don't find any further information. (There ...
11
votes
0answers
225 views

Find sequence of sequences?

There is a function FindSequenceFunction in Mathematica, that can identify a sequence of integers based on a few first elements. But what if I have a set of finite ...
10
votes
9answers
3k views

How can I make a Tribonacci sequence in the form of a list?

How can I make a Tribonacci sequence that is in listing form? it suppose to look like the Fibonacci sequence but I couldn't get ...
2
votes
2answers
176 views

Engel expansion

How do I do an Engel expansion in Mathematica? And find the unique non-decreasing sequence of positive integers $ \{ a_1 ,a_2,a_3,\dots \}$ , such $$\frac{e}{\pi}=\frac{1}{a_1}+\frac{1}{a_1 a_2}+\...
3
votes
1answer
113 views

The permutation of given number sequence that has specific correlation with another

I am interested in the relationship between the Pearson correlation coefficients and the permutations of two random number sequences. An initial Mathematica study is as below: ...
0
votes
1answer
314 views

How to sum over half integers? [closed]

I have an expression of the form Sum[1 + x^n + x^(n^2/2), {n, 0, 10}] but I want to sum over half integers, that is, I require that $n \in \mathbb{Z}+\frac{1}{2}$ ...
1
vote
2answers
377 views

Find the Kimberling Sequence

How to find the Kimberling Sequence by using Mathematica? each row is obtained from the previous by boxing (and expelling) the main diagonal element, and then reading the first number after the box,...
14
votes
10answers
5k views

Fibonacci Sequence Generator

I'm trying to write a function in Workbench which will generate a Fibonacci sequence starting with F0 = 0 and F1 = 1. So far I ...
6
votes
3answers
310 views

Find the number of $n$ such that $n!$ is a sum of three squares

I want to check the following theorem by using Mathematica: $\textbf{Theorem} $. $\text{The estimate}$ $\# \{n \le x:n! \text{ is a sum of three squares}\}=7x/8+O(x^{2/3})$ $\text{holds.}$...
0
votes
2answers
88 views

What would be the most efficient way of finding the first repeated term in Sylvester's sequence modulo the $n$th prime?

If a multiple of a prime, say 13, occurs in Sylvester's sequence, then Sylvester's sequence modulo that prime eventually gets stuck on a bunch of 1's, and FixedPoint...
2
votes
1answer
98 views

Unexpected behavior of FindGeneratingFunction

FindGeneratingFunction will give up to computer sometimes?Such as FindGeneratingFunction[{1, 4, 6, 4, 1}, x] But actually the ...