A381466 a(0) = 4; for n > 0, a(n) = a(n-1) + n if G = 1 or a(n) = n/G if G > 1, where G = gcd(a(n-1), n).
4, 5, 7, 10, 2, 7, 13, 20, 2, 11, 21, 32, 3, 16, 7, 22, 8, 25, 43, 62, 10, 31, 53, 76, 6, 31, 57, 9, 37, 66, 5, 36, 8, 41, 75, 7, 43, 80, 19, 58, 20, 61, 103, 146, 22, 67, 113, 160, 3, 52, 25, 76, 13, 66, 9, 64, 7, 64, 29, 88, 15, 76, 31, 94, 32, 97, 163, 230, 34, 103, 173, 244
Offset: 0
Keywords
Examples
a(12) = 3 and gcd(3, 13) = 1, so a(13) = 3 + 13 = 16. gcd(16, 14) = 2, so a(14) = 14/2 = 7.
Links
- Sam Chapman, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
s={4};Do[G=GCD[s[[-1]],n];AppendTo[s,If[G==1,s[[-1]]+n,n/G]],{n,71}];s (* James C. McMahon, Mar 02 2025 *)
-
PARI
lista(nn) = my(v = vector(nn)); v[1] = 4; for (n=2, nn, my(g=gcd(v[n-1], n-1)); if (g==1, v[n] = v[n-1] + n-1, v[n] = (n-1)/g);); v; \\ Michel Marcus, Feb 26 2025
Comments