

A113051


a(1) = a(2) = 1; for n>2, a(n+1) = a(n) + a(n1) iff a(n) is prime, else a(n+1) = a(n) + 1.


4



1, 1, 2, 3, 5, 8, 9, 10, 11, 21, 22, 23, 45, 46, 47, 93, 94, 95, 96, 97, 193, 290, 291, 292, 293, 585, 586, 587, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 4741, 4742, 4743, 4744, 4745
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

A sequence which is locally Fibonacci at prime values.
a(n) is prime for n = 3, 4, 5, 9, 12, 15, 21, 25, 28, 37, 48, 59, ... a(n) is a nontrivial perfect power for a(6) = 8, a(7) = 9, ... a(n) is Fibonacci for a(1) = a(2) = 1, a(3) = 2, a(4) = 3, a(5) = 5, a(6) = 8, a(10) = 21 = F(8), ...


LINKS

Ivan Neretin, Table of n, a(n) for n = 1..10000


EXAMPLE

a(3) = 2 because a(31) = 1 = 1 is not prime, hence a(3) = a(2) + 1 = 1 + 1 = 2.
a(4) = 3 because a(41) = 2 is prime, hence a(4) = a(3) + a(2) = 2 + 1 = 3.
a(5) = 5 because a(51) = 3 is prime, hence a(5) = a(4) + a(3) = 3 + 2 = 5.
a(6) = 8 because a(61) = 5 is prime, hence a(6) = a(5) + a(4) = 5 + 3 = 8.
a(7) = 9 because a(71) = 8 is not prime, hence a(7) = a(6) + 1 = 8 + 1 = 9.
a(8) = 10 because a(81) = 9 is not prime, hence a(8) = a(7) + 1 = 9 + 1 = 10.


MATHEMATICA

a[1] = a[2] = 1; a[n_] := a[n] = If[ PrimeQ[ a[n  1]], a[n  1] + a[n  2], a[n  1] + 1]; Table[ a[n], {n, 53}] (* Robert G. Wilson v, Oct 14 2005 *)


CROSSREFS

Cf. A000040, A000045, A113050.
Sequence in context: A286489 A002153 A047607 * A047372 A308469 A247547
Adjacent sequences: A113048 A113049 A113050 * A113052 A113053 A113054


KEYWORD

easy,nonn


AUTHOR

Jonathan Vos Post, Oct 12 2005


STATUS

approved



