login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A366470
a(n) = A364054(n-1) mod prime(n-1).
6
1, 0, 1, 4, 4, 2, 2, 0, 15, 3, 1, 26, 26, 24, 24, 18, 18, 16, 16, 12, 12, 6, 81, 81, 73, 73, 71, 63, 57, 57, 29, 29, 23, 23, 13, 13, 1, 158, 154, 154, 148, 148, 138, 138, 134, 134, 122, 122, 118, 118, 114, 114, 112, 112, 106, 106, 100, 100, 94, 94, 92
OFFSET
2,4
LINKS
Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^20.
Michael De Vlieger, Log log scatterplot of a(n), n = 2..2^20, showing a(n) = 0 instead as a(n) = 1/10, with a color function showing b(n) = 0 in black, b(n) = 1 in blue, b(n) = 2 in green, b(n) = 3 in chartreuse, and b(n) = 4 in red, where b() = A366475(). (The plot accentuates larger values of b(n) through larger size, so adjacent smaller values may be eclipsed.)
FORMULA
A364054(n) = A366475(n)*prime(n-1) + a(n) for n > 1. - Michael De Vlieger, Mar 06 2024
MATHEMATICA
nn = 2^20; c[_] := False; m[_] := 0; j = 1; c[0] = c[1] = True;
Monitor[Do[p = Prime[n - 1]; r = Mod[j, p];
While[Set[k, p m[p] + r ]; c[k], m[p]++];
Set[{a[n - 1], c[k], j}, {r, True, k}], {n, 2, nn + 1}], n];
Array[a, nn] (* Michael De Vlieger, Oct 27 2023 *)
PROG
(Python)
from itertools import count, islice
from sympy import nextprime
def A366470_gen(): # generator of terms
a, aset, p = 1, {0, 1}, 2
while True:
yield a
for b in count(a, p):
if b not in aset:
aset.add(b)
a = b%(p:=nextprime(p))
break
A366470_list = list(islice(A366470_gen(), 30)) # Chai Wah Wu, Oct 22 2023
CROSSREFS
Sequence in context: A291085 A193556 A120438 * A192977 A038800 A126712
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Oct 21 2023
STATUS
approved