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!)
A338530 a(n) = (prime(n) + a(n-1)) mod prime(n-1), a(1) = 1. 0
1, 0, 2, 4, 1, 3, 7, 9, 13, 19, 21, 27, 31, 33, 37, 43, 49, 51, 57, 61, 63, 69, 73, 79, 87, 91, 93, 97, 99, 103, 4, 8, 14, 16, 26, 28, 34, 40, 44, 50, 56, 58, 68, 70, 74, 76, 88, 100, 104, 106, 110, 116, 118, 128, 134, 140, 146, 148, 154, 158, 160, 170, 184 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
EXAMPLE
a(2) = (prime(2) + a(1)) mod prime(1) = ( 3 + 1) mod 2 = 0,
a(3) = (prime(3) + a(2)) mod prime(2) = ( 5 + 0) mod 3 = 2,
a(4) = (prime(4) + a(3)) mod prime(3) = ( 7 + 2) mod 5 = 4,
a(5) = (prime(5) + a(4)) mod prime(4) = (11 + 4) mod 7 = 1,
a(6) = (prime(6) + a(5)) mod prime(5) = (13 + 1) mod 11 = 3.
MATHEMATICA
Nest[Append[#1, Mod[(Prime@ #2 + #1[[-1]]), Prime[#2 - 1]]] & @@ {#, Length[#] + 1} &, {1}, 62] (* Michael De Vlieger, Nov 05 2020 *)
PROG
(Ruby) require 'prime'
count = 50
primes = Prime.first(count+1)
values = [1]
count.times { |n| values << (primes[n+1] + values[-1]) % primes[n] }
p values
(PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = (prime(n) + va[n-1]) % prime(n-1); ); va; } \\ Michel Marcus, Nov 05 2020
CROSSREFS
Cf. A000040.
Sequence in context: A348138 A076053 A370020 * A248212 A290824 A272977
KEYWORD
nonn
AUTHOR
Simon Strandgaard, Nov 01 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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)