OFFSET
0,2
COMMENTS
For the definition of "constant congruence speed", see Def. 1.2 (and also Def. 1.1) of "Number of stable digits of any integer tetration" in Links. For all positive integers > 1 and not a multiple of 10, this corresponds to A373387, and (for all n >= 2) the present sequence can be easily derived from A337392 as a(n) = A337392(2*ceiling(n/2)) (for references, see Section 3 of "The congruence speed formula" in Links).
REFERENCES
Marco Ripà, La strana coda della serie n^n^...^n, Trento, UNI Service, Nov 2011. ISBN 978-88-6178-789-6
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..1000
Marco Ripà, The congruence speed formula, Notes on Number Theory and Discrete Mathematics, 2021, 27(4), 43-61.
Index entries for linear recurrences with constant coefficients, signature (0,3,0,4).
FORMULA
For n >= 2, a(n) = 2^(n + (1 - (-1)^n)/2) - (-1)^(n*(n+1)/2).
G.f.: x*(12*x^4 + 9*x^2 + 5*x + 2)/((1 - 2*x)*(1 + 2*x)*(1 + x^2)). - Andrew Howroyd, Nov 06 2025
MATHEMATICA
A389432[n_] := If[n < 2, 2*n, 2^(n + (1 - (-1)^n)/2) - I^(n*(n + 1))]; Array[A389432, 50, 0] (* or *)
LinearRecurrence[{0, 3, 0, 4}, {0, 2, 5, 15, 15, 65}, 50] (* Paolo Xausa, Jan 02 2026 *)
PROG
(Python)
def vp(n, p):
c=0
if n==0:
return 0
while n%p==0:
n//=p
c+=1
return c
def V(a):
if a%10==0 or a==1:
return 0
r=a%20
if r==1:
return min(vp(a-1, 2), vp(a-1, 5))
if r==11:
return min(vp(a+1, 2), vp(a-1, 5))
if a%10 in(2, 8):
return vp(a*a+1, 5)
if r in(3, 7):
return min(vp(a+1, 2), vp(a*a+1, 5))
if r in(13, 17):
return min(vp(a-1, 2), vp(a*a+1, 5))
if a%10==4:
return vp(a+1, 5)
if r==5:
return vp(a-1, 2)
if r==15:
return vp(a+1, 2)
if a%10==6:
return vp(a-1, 5)
if r==9:
return min(vp(a-1, 2), vp(a+1, 5))
if r==19:
return min(vp(a+1, 2), vp(a+1, 5))
return 0
def seq():
s=[]
m=0
while True:
t=V(m)
while len(s)<=t:
s.append(None)
for k in range(t+1):
if s[k] is None:
s[k]=m
print(m)
m+=1
seq()
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Marco Ripà, Oct 03 2025
STATUS
approved
