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”).

A283971
a(n) = n except a(4*n + 2) = 2*n + 1.
3
0, 1, 1, 3, 4, 5, 3, 7, 8, 9, 5, 11, 12, 13, 7, 15, 16, 17, 9, 19, 20, 21, 11, 23, 24, 25, 13, 27, 28, 29, 15, 31, 32, 33, 17, 35, 36, 37, 19, 39, 40, 41, 21, 43, 44, 45, 23, 47, 48, 49, 25, 51, 52, 53, 27, 55, 56, 57, 29, 59, 60, 61, 31, 63, 64, 65, 33, 67
OFFSET
0,4
COMMENTS
From Federico Provvedi, Nov 13 2018: (Start)
For n > 1, a(n) is also the cycle length generated by the cycle lengths of the digital roots, in base n, of the powers of k, with k > 0.
Example for n=10 (decimal base): for every h >= 0, the digital roots of 2^h generate a periodic cycle {1,2,4,8,7,5} with period 6; 3^h generates {1,3,9,9,9,9,...} so the periodic cycle {9} has period 1; 4^h generates the periodic cycle {1,4,7} with period 3; etc. So, for n=10 (decimal base representation) the sequence generated by the periods of the digital roots of powers of k (with k > 0) is also periodic {1,6,1,3,6,1,3,2,1} with period 9, hence a(10) = 9. (End)
FORMULA
a(2*n) = A022998(n), a(1+2*n) = 1 + 2*n.
a(n) = 2*a(n-4) - a(n-8).
From Colin Barker, Mar 19 2017: (Start)
G.f.: x*(1 + x + 3*x^2 + 4*x^3 + 3*x^4 + x^5 + x^6) / ((1 - x)^2*(1 + x)^2*(1 + x^2)^2).
a(n) = -((-1)^n - (-i)^n - i^n - 7)*n/8, where i = sqrt(-1).
(End)
a(n) = A060819(n) * periodic sequence of length 4: repeat [4, 1, 1, 1].
a(n) = a(n-4) + periodic sequence of length 4: repeat [4, 4, 2, 4].
From Werner Schulte, Jul 08 2018: (Start)
For n > 0, a(n) is multiplicative with a(p^e) = p^e for prime p >= 2 and e >= 0 except a(2^1) = 1.
Dirichlet g.f.: (1 - 1/2^s - 1/2^(2*s-1)) * zeta(s-1).
(End)
a(n) = n*(7 + cos(n*Pi/2) - cos(n*Pi) + cos(3*n*Pi/2))/8. - Wesley Ivan Hurt, Oct 04 2018
E.g.f.: (1/4)*x*(4*cosh(x) - sin(x) + 3*sinh(x)). - Franck Maminirina Ramaharo, Nov 13 2018
Sum_{k=1..n} a(k) ~ (7/16) * n^2. - Amiram Eldar, Nov 28 2022
MAPLE
seq(coeff(series(x*(1+x+3*x^2+4*x^3+3*x^4+x^5+x^6)/((1-x)^2*(1+x)^2*(1+x^2)^2), x, n+1), x, n), n=0..80); # Muniru A Asiru, Jul 20 2018
MATHEMATICA
Table[If[Mod[n, 4] == 2, (n - 2)/2 + 1, n], {n, 67}] (* or *)
CoefficientList[Series[x (1 + x + 3 x^2 + 4 x^3 + 3 x^4 + x^5 + x^6)/((1 - x)^2*(1 + x)^2*(1 + x^2)^2), {x, 0, 67}], x] (* Michael De Vlieger, Mar 19 2017 *)
LinearRecurrence[{0, 0, 0, 2, 0, 0, 0, -1}, {0, 1, 1, 3, 4, 5, 3, 7}, 70] (* Robert G. Wilson v, Jul 23 2018 *)
Table[Length[FindTransientRepeat[(Length[FindTransientRepeat[Mod[#1^Range[b]-1, b-1]+1, 2][[2]]]&)/@Range[2, 2*b], 2][[2]]], {b, 2, 100}] (* Federico Provvedi, Nov 13 2018 *)
PROG
(PARI) a(n)=if(n%4==2, n\4*2 + 1, n) \\ Charles R Greathouse IV, Mar 18 2017
(PARI) concat(0, Vec(x*(1 + x + 3*x^2 + 4*x^3 + 3*x^4 + x^5 + x^6) / ((1 - x)^2*(1 + x)^2*(1 + x^2)^2) + O(x^40))) \\ Colin Barker, Mar 19 2017
(GAP) a:=[0, 1, 1, 3, 4, 5, 3, 7];; for n in [9..85] do a[n]:=2*a[n-4]-a[n-8]; od; a; # Muniru A Asiru, Jul 20 2018
(Python)
def A283971(n): return n if (n-2)&3 else n>>1 # Chai Wah Wu, Jan 10 2023
CROSSREFS
KEYWORD
nonn,easy,mult
AUTHOR
Paul Curtz, Mar 18 2017
STATUS
approved