Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [integer-sequence]

The tag has no usage guidance.

-1
votes
1answer
60 views

Mathematica code to solve these problems: [closed]

1.Find the smallest integer number such that: 1+1/2+1/3+...+1/n>14 2.Find the smallest integer number n>1 such that: "SquareRoot" (1^2+2^2+...+n^2) is an integer number 3. Let {an} be a sequence ...
24
votes
3answers
553 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
56 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
54 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
83 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
651 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
116 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
63 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
92 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
76 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,......
47
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
109 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
141 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
47 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
54 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
385 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
90 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
653 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
47 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
291 views

How do I graph only integers using the list function?

I have plotted the following function using the following code: ...
2
votes
1answer
112 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
525 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
59 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
214 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
84 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
14k 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
148 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
817 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
2k 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
371 views

Generate the Fibonacci sequence with Accumulate

Is there a way to generate the Fibonacci sequence with the Accumulate function?
1
vote
1answer
81 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
100 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
218 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
174 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
112 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
290 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
335 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
307 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
86 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
96 views

Unexpected behavior of FindGeneratingFunction

FindGeneratingFunction will give up to computer sometimes?Such as FindGeneratingFunction[{1, 4, 6, 4, 1}, x] But actually the ...
3
votes
0answers
55 views

Prepending a sequence with zeros gives `FindGeneratingFunction` hard time

Asking for FindGeneratingFunction[{1, 3, 11, 43, 171, 683, 2731, 10923, 43691, 174763}, t] gives the answer (namely ...
4
votes
3answers
382 views

Opposite Collatz Conjecture

I'm trying to explore what would happen if you change the collatz conjecture to flip the equations for odds and evens. So if you have an even number you multiply by 3, add 1, and divide by 2. If you ...
2
votes
1answer
96 views

FindInstance skips solutions

I have an equation to compute the bit-error rate of a binary symmetric channel: $$P_{err}(n,p) = \sum_{k = \frac{n-1}{2} + 1}^n\binom n k p^k(1-p)^{n-k}$$ I then want to find the smallest $n$-...
0
votes
1answer
80 views

How to calculate digits of Trott Constants?

How to calculate digits of numbers (Trott Constant) whose continued fraction representation is the same as the digits of its radix representation with Mathematica?
11
votes
2answers
286 views

Animating a growing ListPlot

I stumbled upon this (rather contrived but interesting) integer sequence. As it exhibits quite different behaviour at different scales, I would like to generate an animated ...
4
votes
2answers
943 views

How to plot the Fibonacci convergence to the golden ratio?

I am interested to plot a convergence result of the Fibonacci sequence, namely $\frac{F(n+1)}{F(n)}\rightarrow\phi$ as $n\rightarrow\infty$. So far I have created the following plot: So, I am ...