[go: up one dir, main page]

login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
Search: a358405 -id:a358405
Displaying 1-3 of 3 results found. page 1
     Sort: relevance | references | number | modified | created      Format: long | short | data
A358406 The index of A358405 where n first appears, or 0 if n never appears. +20
3
1, 3, 5, 10, 16, 8, 19, 141, 14, 190, 25, 22, 416, 70, 54, 162, 32, 308, 169, 67, 93, 203, 118, 513, 196, 29, 40, 200, 861, 37, 74, 1081, 82, 216, 208, 363, 90, 46, 375, 1675, 1091, 333, 1407, 812, 166, 78, 51, 1099, 115, 193, 1243, 64, 595, 98, 58, 367, 617, 235, 325, 766, 2137, 272, 124 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
See A358405 for further details.
LINKS
PROG
(Python)
from itertools import count, islice
def agen():
k, an, first, prev = 0, 0, {0: 1}, {0: 1}
for n in count(2):
while k in first: yield first[k]; k += 1
an1 = 0 if first[an] == n-1 else max(n-1-prev[an], first[an])
if an1 not in first: first[an1] = prev[an1] = n
prev[an] = n-1
an = an1
print(list(islice(agen(), 63))) # Michael S. Branicky, Nov 14 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Nov 14 2022
STATUS
approved
A358402 a(1) = 0; for n > 1, let a(n-1) = m; if a(n-1) is the first occurrence of m then a(n) = 0, but if there is a k < n-1 with a(k) = m, a(n) is the minimum of n-1-k and j, where a(j) is the first occurrence of m in the sequence. +10
4
0, 0, 1, 0, 1, 2, 0, 1, 3, 0, 1, 3, 3, 1, 3, 2, 6, 0, 1, 3, 5, 0, 1, 3, 4, 0, 1, 3, 4, 4, 1, 3, 4, 3, 2, 6, 17, 0, 1, 3, 6, 5, 21, 0, 1, 3, 6, 6, 1, 3, 4, 18, 0, 1, 3, 5, 14, 0, 1, 3, 5, 5, 1, 3, 4, 14, 9, 0, 1, 3, 6, 17, 35, 0, 1, 3, 6, 6, 1, 3, 4, 16, 0, 1, 3, 5, 21, 43, 0, 1, 3, 6, 14, 27, 0, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,6
COMMENTS
This sequence can be considered a variation of Van Eck's sequence, see A181391, but where the sequence forms a loop of numbers, joined at its first and last term before each a(n) is calculated. When a previously unseen number first appears the following term is 0, and as 0 appears as the first term of the sequence, the next term after these 0's will always be 1.
See A358403 for the index where each number first appears.
LINKS
Brady Haran and N. J. A. Sloane, Don't Know (the Van Eck Sequence), Numberphile video (2019).
EXAMPLE
a(5) = 1 as a(4) = 0 and 0 appears as the first term of the sequence.
a(6) = 2 as a(5) = 1 and a(3) = 1, these being separated by two terms.
a(17) = 6 as a(16) = 2 and 2 appears as the sixth term of the sequence. Note that the number of terms between the two previous occurrences of 2 is 16 - 6 = 10 which is larger than 6, so 6 is chosen.
MATHEMATICA
nn = 120; q[_] = c[_] = 0; m = a[1] = 0; Do[If[c[#] == 0, k = 0; c[#] = q[#] = n - 1, k = Min[n - 1 - c[#], q[#]]; c[#] = n - 1] &[m]; a[n] = m = k; If[k == u, While[c[u] > 0, u++]], {n, 2, nn}]; Array[a, nn] (* Michael De Vlieger, Jan 21 2023 *)
PROG
(Python)
from itertools import count, islice
def agen():
an, first, prev = 0, {0: 1}, {0: 1}
for n in count(2):
yield an
an1 = 0 if first[an] == n-1 else min(n-1-prev[an], first[an])
if an1 not in first: first[an1] = prev[an1] = n
prev[an] = n-1
an = an1
print(list(islice(agen(), 96))) # Michael S. Branicky, Nov 14 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Nov 14 2022
STATUS
approved
A358403 The index of A358402 where n first appears, or 0 if n never appears. +10
3
1, 3, 6, 9, 25, 21, 17, 109, 198, 67, 860, 114, 148, 261, 57, 137, 82, 37, 52, 215, 447, 43, 105, 404, 267, 163, 414, 94, 154, 1292, 184, 716, 142, 669, 243, 73, 1685, 126, 360, 209, 329, 324, 355, 88, 542, 300, 887, 366, 422, 492, 1053, 1754, 256, 941, 946, 711, 679, 178, 283, 3273, 2221, 225 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
See A358402 for further details.
LINKS
PROG
(Python)
from itertools import count, islice
def agen():
k, an, first, prev = 0, 0, {0: 1}, {0: 1}
for n in count(2):
while k in first: yield first[k]; k += 1
an1 = 0 if first[an] == n-1 else min(n-1-prev[an], first[an])
if an1 not in first: first[an1] = prev[an1] = n
prev[an] = n-1
an = an1
print(list(islice(agen(), 62))) # Michael S. Branicky, Nov 14 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Nov 14 2022
STATUS
approved
page 1

Search completed in 0.007 seconds

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 29 06:09 EDT 2024. Contains 375510 sequences. (Running on oeis4.)