login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A339192 a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) - n if a(n) is nonnegative, not already in the sequence, and gcd(a(n-1),n) > 1 or gcd(a(n-2),n) > 1. Otherwise a(n) = a(n-1) + n. 1
0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9, 24, 8, 25, 43, 62, 42, 63, 41, 64, 40, 15, 41, 14, 42, 71, 101, 132, 100, 67, 33, 68, 32, 69, 31, 70, 30, 71, 29, 72, 28, 73, 27, 74, 26, 75, 125, 176, 124, 177, 123, 178, 122, 179, 121, 180, 120, 181, 119, 56, 120, 55, 121, 188, 256, 325, 255 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

This sequence is a variation of the Recamán sequence A005132 where the same rules apply except an additional restriction is added whereby a(n) = a(n-1) - n can occur only if gcd(a(n-1),n) > 1 or gcd(a(n-2),n) > 1, where gcd is the greatest common divisor. This additional restriction is inspired by the selection rules of A336957 and A098550.

Initially the sequence terms show a similar pattern to the Recamán sequence. However after about 1.5 million terms they begin to predominantly oscillate between two or a small number of values and the pattern of arching lines is no longer present. See the linked images.

It is unclear if all values are eventually visited; numerous small values like 4 and 5 have not occurred after 50 million terms.

LINKS

Table of n, a(n) for n=0..70.

Scott R. Shannon, Image of the terms for n=0 to 10000. The values form a pattern very similar to the Recamán sequence.

Scott R. Shannon, Image of the terms for n=0 to 2000000. Notice the change in behavior after about 1.5 million terms.

Scott R. Shannon, Image of the terms for n=0 to 10000000.

Scott R. Shannon, Image of the terms for n=0 to 50000000.

EXAMPLE

a(4) = 2. As gcd(a(3),4) = gcd(6,4) = 2 > 1, and as 6 - 4 = 2 has not occurred previously, a(4) = 2.

a(23) = 64. a(22) = 41, and 41 - 23 = 18 has not occurred previously. However as gcd(41,23) = 1 and gcd(a(21),23) = gcd(63,23) = 1, both additional criteria for subtraction fail, thus a(23) = a(22) + 23 = 41 + 23 = 64. This is the first term that differs from the standard Recamán sequence A005132.

a(57) = 179. a(56) = 122, and 122 - 57 = 65 has not occurred previously. However as gcd(122,57) = 1 and gcd(a(55),57) = gcd(178,57) = 1, both additional criteria for subtraction fail, thus a(57) = a(56) + 57 = 122 + 57 = 179. This is the first term where n is a composite, less than the last term, and a(n-1) - n is available, but due to the gcd requirements the next term is forced to be a(n-1) + n.

CROSSREFS

Cf. A339557, A339670, A339671, A005132, A336957, A098550.

Sequence in context: A118201 A274647 A113880 * A171884 A339557 A226940

Adjacent sequences:  A339189 A339190 A339191 * A339193 A339194 A339195

KEYWORD

nonn

AUTHOR

Scott R. Shannon, Dec 07 2020

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 9 23:39 EDT 2021. Contains 343746 sequences. (Running on oeis4.)