Vincenzo Manto

A400485

a(1) = 1; for n > 1: if a(n-1) + n is odd, a(n) = a(n-1) + n else a(n) = (a(n-1) + n)/2.

Created: 10/12/2026 | Author: James C. McMahon and Vincenzo Manto , Sep 27 2026

Official Comments

Consecutive terms repeat when a(n-1) = n and such pairs occur for n = 3, 6, 14, 23, 211, 793, 8190, 8208. The next pair is at n = 62906549.
The value of a(n)/n appears to be bound between 1 and approximately 3.66. This range is also observed for sequences when a(1) is seeded with integers > 1 (except for initial terms).

Sequence Chart

Graph of A400485

Data

1,3,3,7,6,6,13,21,15,25,18,15,14,14,29,45,31,49,34,27,24,23,23,47,36,31,29,57,43,73,52,42,75,109,72,54,91,129,84,62,103,145,94,69,57,103,75,123,86,68,119,171,112,83,69,125,91,149,104,82,143,205,134

Formula

Repeating values: when a(n-1) = n, a(n-1) + n = 2n (even), therefore, a(n) = 2n/2 = n. Additionally, when a(n-2) = n + 1, a(n-2) + (n-1) = 2n (even), therefore a(n - 1) = 2n/2 = n.

Computational Implementations

PYTHON

def generate_sequence(size, a1=1):
  a = [0] * (size + 1)
  a[1] = a1
  for n in range(2, size + 1):
    val = a[n - 1] + n
    if val % 2 != 0:
      a[n] = val
    else:
      a[n] = val // 2
  return a[1:]
print(generate_sequence(63))

Mathematica

s={1}; Do[If[OddQ[s[[-1]]+n],AppendTo[s,s[[-1]]+n],AppendTo[s,(s[[-1]]+n)/2]],{n,2,63}];s

Cross-References

See also OEIS entries: Cf A006370