arxiv: v1 [math.nt] 9 Aug 2015

Similar documents
arxiv: v1 [math.nt] 8 Jan 2014

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2

Chapter 8. P-adic numbers. 8.1 Absolute values

Part II. Number Theory. Year

MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES

MATH 361: NUMBER THEORY FOURTH LECTURE

ON UNIVERSAL SUMS OF POLYGONAL NUMBERS

NOTES ON DIOPHANTINE APPROXIMATION

Summary Slides for MATH 342 June 25, 2018

0 Sets and Induction. Sets

SOLUTIONS TO PROBLEM SET 1. Section = 2 3, 1. n n + 1. k(k + 1) k=1 k(k + 1) + 1 (n + 1)(n + 2) n + 2,

Solutions, Project on p-adic Numbers, Real Analysis I, Fall, 2010.

Arithmetic properties of coefficients of power series expansion of. (with an appendix by Andrzej Schinzel)

Part IA. Numbers and Sets. Year

Local Fields. Chapter Absolute Values and Discrete Valuations Definitions and Comments

Number Theory Solutions Packet

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences.

Continued fractions for complex numbers and values of binary quadratic forms

Theory of Numbers Problems

Math 118: Advanced Number Theory. Samit Dasgupta and Gary Kirby

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

Introduction to Number Theory

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

p-adic Analysis Compared to Real Lecture 1

Introduction to Arithmetic Geometry Fall 2013 Lecture #5 09/19/2013

Derangements with an additional restriction (and zigzags)

ZEROES OF INTEGER LINEAR RECURRENCES. 1. Introduction. 4 ( )( 2 1) n

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

(1) Consider the space S consisting of all continuous real-valued functions on the closed interval [0, 1]. For f, g S, define

PROBLEMS ON CONGRUENCES AND DIVISIBILITY

LARGE PRIME NUMBERS (32, 42; 4) (32, 24; 2) (32, 20; 1) ( 105, 20; 0).

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

Real Analysis Math 131AH Rudin, Chapter #1. Dominique Abdi

Representing numbers as the sum of squares and powers in the ring Z n

PRIME NUMBERS YANKI LEKILI

p-adic fields Chapter 7

M381 Number Theory 2004 Page 1

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

P -adic root separation for quadratic and cubic polynomials

Congruences and Residue Class Rings

Jonathan Sondow 209 West 97th Street Apt 6F New York, NY USA

a = a i 2 i a = All such series are automatically convergent with respect to the standard norm, but note that this representation is not unique: i<0

Tewodros Amdeberhan, Dante Manna and Victor H. Moll Department of Mathematics, Tulane University New Orleans, LA 70118

Number Theory. Final Exam from Spring Solutions

Elementary Properties of Cyclotomic Polynomials

Covering Subsets of the Integers and a Result on Digits of Fibonacci Numbers

6 Lecture 6: More constructions with Huber rings

. As the binomial coefficients are integers we have that. 2 n(n 1).

ON MONIC BINARY QUADRATIC FORMS

PRACTICE PROBLEMS: SET 1

Introduction to Arithmetic Geometry Fall 2013 Lecture #24 12/03/2013

ULTRAFILTER AND HINDMAN S THEOREM

Part IA Numbers and Sets

Course 2316 Sample Paper 1

Mathematics Course 111: Algebra I Part I: Algebraic Structures, Sets and Permutations

CSE 20 DISCRETE MATH. Winter

MASTERS EXAMINATION IN MATHEMATICS SOLUTIONS

Week 2: Sequences and Series

On transitive polynomials modulo integers

Chapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms

Induction and Recursion

Number Theory, Algebra and Analysis. William Yslas Vélez Department of Mathematics University of Arizona

Elliptic curves over Q p

MATH 117 LECTURE NOTES

Math 109 HW 9 Solutions

k, then n = p2α 1 1 pα k

Math 314 Course Notes: Brief description

Number Theory Homework.

FILTERED RINGS AND MODULES. GRADINGS AND COMPLETIONS.

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

Open Problems with Factorials

Wilson s Theorem and Fermat s Little Theorem

Part III. x 2 + y 2 n mod m

Homework 7 solutions M328K by Mark Lindberg/Marie-Amelie Lawn

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

I Foundations Of Divisibility And Congruence 1

Introduction to Information Security

Contents. 4 Arithmetic and Unique Factorization in Integral Domains. 4.1 Euclidean Domains and Principal Ideal Domains

MATH 3030, Abstract Algebra FALL 2012 Toby Kenney Midyear Examination Friday 7th December: 7:00-10:00 PM

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

Metric Spaces Math 413 Honors Project

3 Solutions of congruences

Number Theory Marathon. Mario Ynocente Castro, National University of Engineering, Peru

The primitive root theorem

PUTNAM PROBLEMS SEQUENCES, SERIES AND RECURRENCES. Notes

Introduction to Lucas Sequences

Chapter 1. Sets and Numbers

Math 320: Real Analysis MWF 1pm, Campion Hall 302 Homework 8 Solutions Please write neatly, and in complete sentences when possible.

1. Suppose that a, b, c and d are four different integers. Explain why. (a b)(a c)(a d)(b c)(b d)(c d) a 2 + ab b = 2018.

Chris Smyth School of Mathematics and Maxwell Institute for Mathematical Sciences, University of Edinburgh, Edinburgh EH9 3JZ, UK.

Metric Spaces Math 413 Honors Project

p = This is small enough that its primality is easily verified by trial division. A candidate prime above 1000 p of the form p U + 1 is

Jeong-Hyun Kang Department of Mathematics, University of West Georgia, Carrollton, GA

MINIMAL GENERATING SETS OF GROUPS, RINGS, AND FIELDS

Climbing an Infinite Ladder

Solutions to Problem Set 3 - Fall 2008 Due Tuesday, Sep. 30 at 1:00

Number Theory Marathon. Mario Ynocente Castro, National University of Engineering, Peru

THE DENOMINATORS OF POWER SUMS OF ARITHMETIC PROGRESSIONS. Bernd C. Kellner Göppert Weg 5, Göttingen, Germany

On Arithmetic Properties of Bell Numbers, Delannoy Numbers and Schröder Numbers

Rings in Coding Theory

Transcription:

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS AND ITS GENERALIZATIONS PIOTR MISKA arxiv:1508.01987v1 [math.nt] 9 Aug 2015 Abstract. The sequence of derangements is given by the formula D 0 = 1,D n = nd n 1 + ( 1) n,n > 0. It is a classical object appearing in combinatorics and number theory. In this paper we consider two classes of sequences: first class is given by the formulae a 0 = h 1 (0),a n = f(n)a n 1 + h 1 (n)h 2 (n) n,n > 0, where f,h 1,h 2 Z[X], and the second one is defined by a n = n n! j! h(n)j,n N, where h Z[X]. Both classes are a generalization of the sequence of derangements. We study such arithmetic properties of these sequences as: periodicity modulo d, where d N +, p-adic valuations, asymptotics, boundedness, periodicity, recurrence relations and prime divisors. Particularly we focus on the properties of the sequence of derangements and use them to establish arithmetic properties of the sequences of even and odd derangements. Contents 1. Introduction 2 2. Definitions and conventions 4 3. Hensel s lemma for p-adic continuous functions approximated by polynomials over Z 5 3.1. Hensel s lemma for pseudo-polynomial decomposition modulo p 5 3.2. Connection between pseudo-polynomial decomposition modulo p and p-adic continuous functions approximated by polynomials over Z 7 3.3. Hensel s lemma for exponential function 9 4. Arithmetic properties of sequences a R 12 4.1. Periodicity modulo d and p-adic valuations 12 4.2. Asymptotics and connection between boundedness and periodicity of a sequence a R 22 4.3. The polynomials arising in the recurrence relation for a sequence a R and their real roots 30 4.4. Divisors of a sequence a R 33 5. Arithmetic properties of the sequences of even and odd derangements 44 6. Some diophantine equations with numbers of derangements 48 6.1. Diophantine equations involving factorials 48 6.2. When a number of derangements is a power of a prime number? 52 7. Arithmetic properties of h-schenker sums 54 7.1. Divisibility by primes, periodicity modulo p and p-adic valuations of h-schenker sums 54 7.2. Bounds on h-schenker sums and infinitude of the set of h-schenker primes 57 Acknowledgements 61 2010 Mathematics Subject Classification. 11B50, 11B83. Key words and phrases. derangement, Hensel s lemma, p-adic valuation, periodicity, prime number. 1

2 PIOTR MISKA References 61 1. Introduction By the term of derangement we call a permutation in S n without fixed points. We define the n-th number of derangements as the number of all derangements of the set with n elements. We denote this number byd n. The sequence (D n ) n N, can be described by the recurrence D 0 = 1,D n = nd n 1 +( 1) n,n > 0. The sequence (D n ) n N is a subject of reaserch of many mathematicians. It is connected to other well known sequences. In particular, the sequence of numbers of derangements (or shortly, the sequence of derangements) appears in a natural way in the paper [22], devoted to the Bell numbers. In [18] we gave and proved a criterion for behavior of p-adic valuation of the Schenker sum a n, given by the formula a n = n n! j! nj, n N. We expected that the method of proving this criterion could be generalized to other class of integer sequences. The trial of generalization of this method is one of the motivations for preparing this paper. In Section 2 we set conventions and recall facts which are used in further parts of the thesis. In Section 3 we define pseudo-polynomial decomposition modulo p of a given sequence. If a sequence has this property then we can use the same method of proof as in [18] to obtain the description of p-adic valuation of elements of this sequence. Furthermore, we show that a sequence with pseudo-polynomial decomposition modulo p can be expressed as a product of functions f and g, where f : Z p Z p is a p-adic continuous function which can be approximated by polynomials with integer coefficients and g : N Z p \pz p. The last part of Section 3 is devoted to description of p-adic valuation of the exponential function Z n a n Z. The results from Section 3 are used in Section 4 to study arithmetic properties of a family of sequences a = a(f,h 1,h 2 ) = (a n ) n N given by the recurrence relation (1) a 0 = h 1 (0),a n = f(n)a n 1 +h 1 (n)h 2 (n) n,n > 0, where f,h 1,h 2 Z[X]. Let us define R := {a(f,h 1,h 2 ) R N : f,h 1,h 2 Z[X]}. If f = X, h 1 = 1 and h 2 = 1 then we obtain the sequence of derangements (D n ) n N, hence the class of sequences given by the relation (1) can be treated as a generalization of the sequence of derangements. Section 4.1 is concerned with the periodicity of the sequences(a n (mod d)) n N of remainders modulo d of a given sequence (a n ) n N, where d N +. Moreover we focus on p-adic valuations of the sequence (a n ) n N, when p f(n) for some n N and h 2 = ±1. Due to the divisibility n 1 D n for all n N, we study closer prime divisors and p-adic valuations of the sequence ( Dn n 1 ) n N 2. We prove that the set of prime divisors of the numbers Dn n 1, n 2, is infinite. Section 4.2 is devoted to asymptotics of a given sequence a R and connection between boundedness and periodicity of this sequence. The main result of this section is that each bounded sequence (a n ) n N is ultimately constant or ultimately periodic with period 2. In Section 4.3 we obtain some recurrence relations for a sequencea(f,h 1,h 2 ) R, when h 2 = ±1. Then we study real roots of the polynomials ocurring in these

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS 3 relations and we conclude that for d N + the polynomial which arises in the formula d 1 f d = ( 1) j j 1 (X i) Z[X], d 1 D n = D n d (n i)+( 1) n f d (n), n d, has exactly d 1 real roots and exactly one rational root 1. Section 4.4 deals with divisors of terms of a sequence a R. Section 4.4.1 is a trial of generalization of the result from Section 4.1 that there are infinitely many prime divisors of the numbers Dn n 1, n 2. We give some conditions for infinitude of set of prime divisors of a given sequence a. The last two results in Section 4.4.1 show that if a sequence (a n ) n N is given by the formula a 0 = c,a n = (b 1 n+b 0 )a n 1 +c,n > 0 for some integers b 0,b 1,c and b 0,b 1 are not simultaneously 0 then there are infinitely many prime divisors of the numbers a n, n N. In Section 4.4.2 we generalize the property n 1 D n, n N. Namely, we consider sequences given by the formula a 0 = h 1 (0),a n = (n b)a n 1 + h 1 (n)h 2 (n) n,n > 0, where b Z is fixed, and study when n b 1 a n. In Section 5 we use the results on the sequence of derangements to obtain arithmetic properties of the sequences of even and odd derangements. First of all we present recurrence relations for these two sequences. We obtain relations involving numbers of even and odd derandements in order to write them as expressions dependent on numbers of derangements. Next we show their asymptotics and periodicity modulo d, where d N +. From the periodicity properties we conclude divisibilities of these numbers and describe their p-adic valuations. The subject of Section 6 are diophantine equations with numbers of usual, odd and even derangements, respectively. In Section 6.1 we find all the numbers of usual and odd derangements which are factorials. Meanwhile in Section 6.2 we try to establish for which indices n the numbers of usual, odd and even derangements, respectively, are powers of prime numbers. Section 7 is devoted to the h-schenker sums, given by the formula a n = n n! j! h(n)j,n N, where h is a given polynomial with integer coefficients. If h = X then we obtain the sequence of Schenker sums, hence the motivation to call the mentioned class of sequences by h-schenker sums. If h = 1 then h-schenker sums are numbers of derangements, so the sequence of h-schenker sums can be seen as a generalization of the sequence of derangements. In [1] and [18] there were established some results on p-adic valuations of Schenker sums and infinitude of the set of so-called Schenker primes (such prime numbers p that p a n for some n N not divisible by p). In Section 7 we generalize these results. In Section 7.1 we prove periodicty modulo d of h-schenker sums for a given d N + and describe their p-adic valuations. During considerations on p-adic valuations we define h-schenker prime as prime number p such that p a n and p h(n) for some n N. Section 7.2 starts with giving bounds on absolute values of h-schenker sums. Next these bounds are used to establish infinitude of the set of h-schenker primes for h 0.

4 PIOTR MISKA 2. Definitions and conventions We assume thatn = {0,1,2,3,...} andn + = {1,2,3,...}. For a given positive integer k we denote the set of all integers greater than or equal to k by N k. We denote the set of all prime numbers by P. = 1, when j,k Z and j > k. Let a,b Z and b 0. Then by a (mod b) we denote the remainder from the division of a by b. By s d (n) we denote the sum of digits of positive integer n in base d, i.e. if n = m c id i is an expansion of n in base d then s d (n) = m c i. We set a convention that 0 0 = 1, k i=j = 0 and k i=j LetA,B be topological spaces. The set of all continuous functionsf : A B we denote by C(A,B). If C is a subset of A then its closure in A we denote by C. Fix a prime number p. Every nonzero rational number x can be written in the form x = a b pt, where a Z, b N +, gcd(a,b) = 1, p ab and t Z. Such a representation of x is unique, thus the number t is well defined. We call t the p-adic valuation of the number x and denote it by v p (x). By convention, v p (0) = +. In particular, if x Q \ {0} then x = p prime pvp(x), where v p (x) 0 for finitely many prime numbers p. For every rational number x we define its p-adic norm x p by the formula x p = { p vp(x), when x 0 0, when x = 0. Since for all rational numbers x,y we have x+y p min{ x p, y p }, hence p-adic norm gives a metric space structure on Q. Namely, the distance between rational numbers x,y is equal to d p (x,y) = x y p. The field Q equipped with p-adic metric d p is not a complete metric space. The completion of Q with respect to this metric has structure of field and this field is called the field of p-adic numbers Q p. We extend the p-adic valuation and p-adic norm on Q p in the following way: v p (x) = lim n + v p (x n ), x p = lim n + x n p, where x Q p, (x n ) n N Q and x = lim n + x n. The values v p (x) and x p do not depend on the choice of a sequence (x n ) n N, thus they are well defined (see [4]). We define the ring of integer p-adic numbers Z p as a set of all p-adic numbers with nonnegative p-adic valuation. Note that Z p is the completion of Z as a space with p-adic metric. We assume that the expression x y (mod p k ) means v p (x y) k for prime number p, an integer k and p-adic numbers x,y. By the term p-adic continuous function we mean function f : S Q p defined on some subset S of Q p, which is continuous with respect to p-adic metric. By the term p-adic contraction we mean such function f : S Q p that f(x) f(y) p x y p for arbitrary x,y S. Assuming that S is an open subset of Q p, we will say f(x) f(x that f is differentiable at a point x 0 S, if there exists a limit lim 0) x x0 x x 0. In this situation this limit we will call the derivative of f at the point x 0 and denote it by f (x 0 ). We use the Landau symbol O in the following sense: if f,g : N R are two real-valued functions defined on N then f(n) is O(g(n)), when there exists such a constant M 0 and a nonnegative integer n 0 that f(n) M g(n) for n n 0. In general, if there exists an n 0 N such that some property holds for n n 0 then for simplicity of notation we will write that this property is satisfied for n 0.

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS 5 3. Hensel s lemma for p-adic continuous functions approximated by polynomials over Z In [18] there was presented a consideration which allows to describe p-adic valuation of Schenker sums, given by the formula a n = n n! j! nj. In this section we will extend this method to more general class of sequences. The results given in the following section will be used in the sequel. 3.1. Hensel s lemma for pseudo-polynomial decomposition modulo p. Definition 1. Let p be a prime number and (a n ) n N Z p. By pseudo-polynomial decomposition of the sequence(a n ) n N modulopon a sets N we mean a sequence of pairs (f p,k,g p,k ) k N2 such that: f p,k Z p [X], g p,k : S Z p \pz p, k 2; a n f p,k (n)g p,k (n) (mod p k ) for all n S, k 2; f p,k (n) f p,2(n) (mod p) for any k 2 and n S, where f means the derivative of a polynomial f. We say that (a n ) n N has a pseudopolynomial decomposition modulo p if it has a pseudo-polynomial decomposition modulo p on N. Remark 1. Let n k N and assume that a set S N is dense in the set {n N : n n k (mod p k )} with respect to p-adic metric. Since {n N : n n l (mod p l )} = {n N : d p (n,n l ) < p 1 l } for any integer l k and positive integer n l n k (mod p k ), hence S {n N : n n l (mod p l )}. Theorem 1 (Hensel s lemma for pseudo-polynomial decomposition modulo p). Let p be a prime number, k N +,n k N be such that p k a nk and assume that (a n ) n N Z p has a pseudo-polynomial decomposition modulo p on S N, where n k S. Let us define q p (n k ) = 1 p ( ank +p g p,2(n k +p) an k g p,2(n k ) If v p (q p (n k )) = 0 and S is dense in the set {n N : n n k (mod p k )} with respect to p-adic metric then there exists a unique n k+1 modulo for which n k+1 n k (mod p k ) and p k+1 a n for all n S congruent to n k+1 modulo p k+1. What is more, n k+1 n k ). a nk g p,k+1 (n k )q p(n k ) (mod pk+1 ). If v p (q p (n k )) > 0 and p k+1 a nk then p k+1 a n for all n S satisfying n n k (mod p k ). If v p (q p (n k )) > 0 and p k+1 a nk then p k+1 a n for any n S satisfying n n k (mod p k ). In particular, if k = 1, p a n1, v p (q p (n 1 )) = 0 then for any l N + there exists a unique n l modulo p l such that n l n 1 (mod p) and v p (a n ) l for all n S congruent to n l modulo p l. Moreover, n l satisfies the congruence n l n l 1 a nl 1 g p,l (n l 1 )q p(n 1) (mod pl ) for l > 1. In [18] there was showed that the sequence of Schenker sums (a n ) n N satisfies the congruence a n n n pk +2 f p,k (n) (mod p k ) for each positive integer k, prime number p and positive integer n not divisible by p, where d 1 f p,k = X d j 2 j 1 (X i). Moreover, if k 1,k 2 2 then f p,k 1 (n) f p,k 2 (n) (mod p). This fact and Hensel s lemma allow to state the criterion for behavior of p-adic valuation of the Schenker sums. In order to prove Theorem 1 we will use the following version of Hensel s lemma (see [19, p. 44] and [4, p. 49]):

6 PIOTR MISKA Theorem 2 (Hensel s lemma). Let p be a prime number, k be a positive integer and f be a polynomial with integer p-adic coefficients. Assume that f(n 0 ) 0 (mod p k ) for some integer n 0. Then the number of solutions n of the congruence f(n) 0 (mod p k+1 ), satisfying the condition n n 0 (mod p k ), is equal to: 1, when f (n 0 ) 0 (mod p); 0, when f (n 0 ) 0 (mod p) and f(n 0 ) 0 (mod p k+1 ); p, when f (n 0 ) 0 (mod p) and f(n 0 ) 0 (mod p k+1 ). Now we are ready to prove Theorem 1. Proof of Theorem 1. Let us note that iff Z p [X] then for any x 0 Z p there exists an r Z p [X] such that (2) f(x) = f(x 0 )+(X x 0 )f (x 0 )+(X x 0 ) 2 r(x). Using the equality above for f = f p,2, x 0 = n k and X = n k +p, we have: f p,2 (n k +p) f p,2 (n k )+pf p,2(n k ) (mod p 2 ). This congruence and Definition 1 imply the following: f p,k+1 (n k) f p,2 (n k) 1 p (f p,2(n k +p) f p,2 (n k )) 1 ( ank +p p g p,2 (n k +p) a ) n k = q p (n k ) (mod p). g p,2 (n k ) Thus q p (n k ) f p,k+1 (n k) (mod p). Since p g p,k+1 (n) for each nonnegative n n k (mod p k ), hence v p (a n ) = v p (f p,k+1 (n)) for such n. By Theorem 2 we conclude that: if v p (q p (n k )) = 0 then f (n 0 ) 0 (mod p) and there exists a unique n k+1 modulo p k+1 for which p k+1 a nk+1 and n k+1 n k (mod p k ); if v p (q p (n k )) > 0 and p k+1 a nk then f (n 0 ) 0 (mod p) and p k+1 a nk+1 for any n k+1 S satisfying n k+1 n k (mod p k ); if v p (q p (n k )) > 0 and p k+1 a nk then f (n 0 ) 0 (mod p) and p k+1 a nk+1 for any n k+1 S satisfying n k+1 n k (mod p k ). Let us consider the case v p (q p (n k )) = 0 and write n k+1 = n k +p k t k+1, where t k+1 Z. Use (2) for f = f p,k+1, x 0 = n k and X = n k + p k t k+1 to obtain the sequence of congruences: (3) 0 f p,k+1 (n k )+p k t k+1 f p,k+1(n k ) (mod p k+1 ) t k+1 q p (n k ) t k+1 f p,k+1 (n k) f p,k+1(n k ) p k (mod p) t k+1 f p,k+1(n k ) p k q p (n k ) (mod p) n k+1 = n k +p k t k+1 n k f p,k+1(n k ) q p (n k ) a nk (mod p k+1 ). Sincef p,k+1 (n k ) g p,k+1 (n k ) (mod pk+1 ), we getn k+1 n k g p,k+1 (n k )q p(n k ) (mod p k+1 ). Assume now that k = 1 and v p (q p (n 1 )) = 0. By simple induction on l N + we obtain that the inequality v p (a n ) l has a unique solution n l modulo p l with condition n l n 1 (mod p) and this solution satisfies the congruence for l > 1. n l n l 1 f p,l(n l 1 ) q p (n 1 ) (mod p l ) a nk

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS 7 Certainly the statement is true for l = 1. Now, assume that there exists a unique n l modulo p l satisfying the conditions in the statement. Note that q p (n l ) f p,2 (n l) f p,2 (n 1) q p (n 1 ) (mod p). Since v p (q p (n 1 )) = 0 then there exists a unique n l+1 modulo p l+1 such that p l+1 a nl+1 and n l+1 n l (mod p l ). Additionaly the congruences (3) showed that n l+1 a n l nl g p,l+1 (n l )q (mod p(n 1) pl+1 ). 3.2. Connection between pseudo-polynomial decomposition modulo p and p-adic continuous functions approximated by polynomials over Z. It is worth to see that if a sequence (a n ) n N has a pseudo-polynomial decomposition modulo p then there exist functions f p, C(Z p,z p ) and g p, : N Z p \pz p such that a n = f p, (n)g p, (n) for each nonnegative integer n. Let k N +, p P and put: P p,k = {F polynomial function on Z/p k Z : G:N Z\pZ n N : a n F(n)G(n) (mod p k )}. For each k N + set P p,k is finite (because there are only finitely many functions on Z/p k Z) and nonempty (by existence of pseudo-polynomial decomposition). We have the map ψ k+1 : P p,k+1 F F (mod p k ) P p,k of reduction modulo p k. Theorem 3. Let (S k ) k N+ be a sequence of finite nonempty sets with mappings ψ k+1 : S k+1 S k,k N +. Then there exists a sequence (s k ) k N+ such that s k S k and ψ k+1 (s k+1 ) = s k for each k N +. Proof. See [21, p. 13]. By Theorem 3 there exist polynomial functions F p,k : Z/p k Z Z/p k Z such that F p,k+1 F p,k (mod p k ),k N +. Furthermore, for each k N + there exists f p,k Z[X] such that f p,k F p,k (mod p k ). As a result, if k 1 k 2 then f p,k2 (x) f p,k1 (x) 0 (mod p k1 ),x Z p, or in other words f p,k2 (x) f p,k1 (x) p p k1. Since Z[X] is a subset of C(Z p,z p ) and C(Z p,z p ) with metric d sup (f,g) = sup x Zp f(x) g(x) p is a complete metric space, hence the sequence (f p,k ) k N+ C(Z p,z p ) is uniformly convergent to a continuous function f p, : Z p Z p. Each polynomial from Z p [X] is a p-adic contraction, so f p, = lim k + f p,k is a p- adic contraction, too. From the definition of P p,k there exists g p,k : N Z\pZ such that a n f p,k (n)g p,k (n) (mod p k ),n N. As a consequence of our reasoning we have that if a n 0 for some n N then v p (a n ) = v p (f p,k (n)) for sufficiently large k and by continuity of p-adic valuation (with respect to p-adic norm) v p (a n ) = v p (f p, (n)). If a n = 0 for some n N then v p (f p,k (n)) k and going with k to + we obtain v p (f p, ) = +, which means that f p, (n) = 0. Then we define g p, by the formula: { an f g p, (n) =, if a p, (n) n 0 1, if a n = 0. Conversely, assume that a n = f p, (n)g p, (n) for some f p, Z p [X] C(Z p,z p ) (with respect to metric d sup ) and g p, : N Z p \pz p. For k 2, let f p,k Z p [X] be such that d sup (f p,k,f p, ) p k (replacing coefficients of f p,k by integers congruent to them modulo p k we can assume that f p,k Z[X]). Because there are only finitely many polynomial functions on Z/pZ then we can choose a sequence of polynomials (f p,k ) k N2 Z p [X] such that f p,k 1 (n) f p,k 2 (mod p) for each n Z and k 1,k 2 2. For k 2 and n N we put g p,k (n) as an integer congruent to g p, (n) modulo p k. Finally, we obtain pseudo-polynomial decomposition (f p,k,g p,k ) k N2 modulo p of the sequence (a n ) n N.

8 PIOTR MISKA v p (1 p In particular, if p a n1 for some n 1 N and p f p,2(n 1 ) (or equivalently ( )) an1 +p g an 1 p,2(n 1+p) g p,2(n 1) = 0) then there exists a unique n Z p such that n n 1 (mod p) and f p, (n ) = 0. Indeed, Theorem 1 gives us existence and uniqueness of n k modulo p k such that n k n 1 (mod p) and p k a nk for each k N +. Hence p k f p, (n k ), which means that f p, (n k ) p p k. If k 1 k 2 then by uniqueness of n k1 modulo p k1 we have n k1 n k2 (mod p k1 ), or in other words n k1 n k2 p p k1. We thus conclude that (n k ) k N+ is a Cauchy sequence and by completeness of Z p this sequence is convergent to some n. By continuity of f p,, f p, (n ) p = lim k + f p, (n k ) p = 0. For all k N +, n n k (mod p k ) and by uniqueness of n k modulo p k, such n, that n n 1 (mod p) and f p, (n ) = 0, is unique. Let us note that if f : Z p Z p is a p-adic contraction then f can be approximated uniformly on Z p by the sequence of polynomials (f p,k ) k N+ Z[X] such that f p,k (n) = f(n),n {0,1,2,...,p k 1} for each k N +. Indeed, for each x Z p we have f p,k (x) f(x) p = (f p,k (x) f p,k (x (mod p k ))) (f p,k (x (mod p k )) f(x)) p max{ f p,k (x) f p,k (x (mod p k )) p, f(x (mod p k )) f(x) p } p k. As a result, the closure of the rings Z[X] and Z p [X] in the space C(Z p,z p ) with metric d sup is the set of all p-adic contractions f : Z p Z p. In particular, if a sequence (a n ) n N is such that (a n (mod p k )) n N is periodic of period p k for each k N + then (a n ) n N (as a function mapping N to Z p ) is a p-adic contraction (if n m p = p k then p k n m and p k a n a m, which means that a n a m p p k ). Since N is dense in Z p, the sequence (a n ) n N can be extended to a function f C(Z p,z p ). Thus there exists a sequence (f p,k ) k N+ Z[X] N+ converging uniformly to f on Z p. Because of finiteness of the set of polynomial functions on Z/pZ we can choose polynomials f p,k, k N 2, such that f p,k 1 (n) f p,k 2 (mod p) for each n Z and k 1,k 2 2. Finally, the sequence (f p,k,1) k N2 is a pseudo-polynomial decomposition modulo p of the sequence (a n ) n N (where 1 means the function mapping each nonnegative integer n to 1). The following three examples show that there is no connection between approximability of a given function f : Z p Z p by polynomials over Z p and its differentiability. Example 1. Let us note that each x Z p can be written uniquely as a series + a j(x)p j, where a j (x) {0,1,...,p 1} for each j N (see [4]). Moreover, if x 0 then v p (x) is the least index j such that a j (x) 0. Let p be an odd prime number and let us consider a function f : Z p Z p given by the formula { x a f(x) = vp(x) (x), if x 0, 0, if x = 0. The function f is a p-adic contraction. First we see that f(x) p = x p for each x Z p. Let k N and x,y Z p be such that x y p = p k. Let us write x = + a j(x)p j and y = + a j(y)p j, where a j (x),a j (y) {0,1,...,p 1} for j N. Then k is the least index j such that a j (x) a j (y). Let us consider two cases. (1) Assume first that v p (x) = v p (y) < k. Then a vp(x)(x) = a vp(y)(y) 0 and x y as a result f(x) f(y) p = = x y p = p k. p a vp(x) (x)

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS 9 (2) Assume now that one of the numbers x,y has p-adic valuation equal to k. Without loss of generality we set v p (x) = k. Then v p (y) k and as a consequence v p (f(x)) = k and v p (f(y)) k. We thus have v p (f(x) f(y)) k or in other words f(x) f(y) p p k. Hence f Z[X]. On the other hand, the function f is not differentiable at 0, f(ap because lim n ) f(0) p n + ap = lim n n n + ap = 1 n a for each a {1,...,p 1}. Example 2. Let p be an arbitrary prime number and function f : Z p Z p be given by the formula { ( 1) vp(x) x, if x 0, f(x) = 0, if x = 0. The function f is a p-adic contraction (in fact, f is an isometry, i.e. f(x) f(y) p = x y p for any x,y Z p ). First we see that f(x) p = x p for each x Z p. Let k N and x,y Z p be such that x y p = p k. Let us consider two cases. (1) Assume first that v p (x) = v p (y). Then f(x) f(y) p = ( 1) v p(x) (x y) p = x y p = p k. (2) Assume now that v p (x) v p (y). Then one of the numbers x,y has p-adic valuation equal to k and the second one has p-adic valuation greater than k. Without loss of generality we set v p (x) = k and v p (y) > k. As a consequence v p (f(x)) = k and v p (f(y)) > k. We thus have v p (f(x) f(y)) = k or in other words f(x) f(y) p = p k. Hence f Z[X]. On the other hand, the function f is not differentiable at 0, f(p because lim 2n+r ) f(0) ( 1) n + p = lim r p 2n+r 2n+r n + p = ( 1) r for r {0,1}. 2n+r Example 3. Let a function f : Z p Z p be given by the formula { x p, if p x, f(x) = x, if p x. Obviously, the function f is differentiable at each point x Z p and its derivative is equal to 1 p for x pz p and 1 otherwise. However, if x,y pz p then f(x) f(y) p = = p x y p. Hence f is not ap-adic contraction, which means that f Z[X]. p x y p 3.3. Hensel s lemma for exponential function. Let us fix a prime number p, an integer a and consider now exponential function f : N n a n Z. In general it is not a p-adic continuous function, but if p a and m N is fixed then the function g : N n a n(p 1)+m Z is continuous. Indeed, by Fermat s little theorem a p 1 = 1+pb for some b Z and a n(p 1) = n ( ) n (pb) j = j n p j b j j! j 1 (n i) = Note that v p ( pj b j j! ) j v p (j!) = j j sp(j) p 1 formula v p (j!) = j sp(j) p 1,j N, see [12]) and v p( j 1 consecutive integers there are at least j p define f p,k = kp 1 p j b j j! + p j b j j! j 1 (n i). p 2 p 1j 0 (we use Legendre s (n i)) j p (between j integers divisible by p). This suggests to j 1 (X i) Z p [X]

10 PIOTR MISKA for k 2. Then a n(p 1) f p,k (n) (mod p k ) and kp 1 f p,k (n) = p j b j j! j 1 j 1 s=0,i s (n i) 2p 1 p j b j j! j 1 j 1 s=0,i s (n i) (mod p). Hence (f p,k,1) k N2, where 1 means the function defined on N constantly equal to 1, is a pseudo-polynomial decomposition of (a n(p 1) ) n N. Additionaly, the formula a x(p 1) = f p, (x) = + j 1 (x i) extends the function N n p j b j j! a n(p 1)+m Z to a continuous function defined on Z p. However, this function has one more property. Namely, if p k x y then p k+1 a x(p 1) a y(p 1), or in other words a x(p 1) a y(p 1) p 1 p x y p. Because N is dense in Z p, thus it suffices to show this property for x,y N, where x > y. Let x = y + p k t for some positive integer t not divisible by p. Then a x(p 1) a y(p 1) = a y(p 1) (a tpk (p 1) 1) and by Euler s theorem p k+1 (a t ) pk (p 1) 1. The mentioned property is a motivation to state an analogue of Hensel s lemma for exponential function. Theorem 4 (Hensel s lemma for exponential function). Let p be a prime number and k be a positive integer. Let a,c be integers not divisible by p. Let m,n k be nonnegative integers such that n k < m and s = v p (a pk (p 1) 1) (by Euler s theorem s k +1). If p s a n k(p 1)+m c then for each positive integer l there exists a unique n k+l modulo p k+l such that n k+l n k (mod p k ) and p s+l a n k+l(p 1)+m c. If p s a n k(p 1)+m c then p s a n(p 1)+m c for all n n k (mod p k ). In particular, if m = 0 and c = 1 then for each positive integer l there exists a unique n k+l modulo p k+l such that p s+l a n k+l(p 1) 1. Proof. The second case of the statement is very easy. If n n k (mod p k ) then (a n(p 1)+m c) (a n k(p 1)+m c) = a n k(p 1) (a (n n k)(p 1) 1). Since p a and p k n n k, thus a pk (p 1) 1 a (n n k)(p 1) 1 and as a consequence p s a n k(p 1) (a (n n k)(p 1) 1). Because p s a n k(p 1)+m c, hence p s a n(p 1)+m c. Now we prove the first case of the statement of our theorem. First, we show by induction on l N that v p (a pk+l (p 1) 1) = s + l. The induction hypothesis is obviously true forl = 0. Assume that a pk+l (p 1) = 1+p s+l t l and p t l. Then a pk+l+1 (p 1) = (a pk+l (p 1) ) p = (1+p s+l t l ) p = p = 1+p s+l+1 t l +p s+l+2 u l = 1+p s+l+1 (t l +pu l ), ( ) p p j(s+l) t j l j = where u l Z. Assume now that l N and p s+l a n k+l(p 1)+m c. Write n k+l+1 = n k+l + p k+l w and a n k+l(p 1)+m c p s+l z (mod p s+l+1 ). Then we obtain the

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS 11 sequence of equivalent congruences: a nk+l+1(p 1)+m c 0 (mod p s+l+1 ) a (n k+l+p k+l w)(p 1)+m c (mod p s+l+1 ) a wpk+l (p 1) a nk+l(p 1)+m c (mod p s+l+1 ) (1+p s+l t l ) w (c+p s+l z) c (mod p s+l+1 ) (1+wp s+l t l )(c+p s+l z) c (mod p s+l+1 ) wp s+l t l (c+p s+l z) p s+l z (mod p s+l+1 ) wt l c z (mod p) Since p t k+l c, thus the last congruence has exactly one solution w modulo p, which means that the first congruence has exactly one solution n k+l+1 modulo p k+l+1 such that n k+l+1 n k (mod p k ).

12 PIOTR MISKA 4. Arithmetic properties of sequences a R The main point of this paper is to investigate arithmetic properties of sequence of derangements and to generalize this properties to some class of sequences. This section is devoted to the family R of sequences a given by the recurrence a 0 = h 1 (0),a n = f(n)a n 1 +h 1 (n)h 2 (n) n,n > 0, where f,h 1,h 2 Z[X]. In order to emphasize the polynomials f,h 1,h 2 appearing in this recurrence, we will denote a = a(f,h 1,h 2 ). Sequences from the class R are natural generalization of the sequence of derangements, which is obtained for f = X,h 1 = 1,h 2 = 1. Note that many well-known sequences belong to this class: if f,h 2 = 1,h 1 = c Z then (a n ) n N = (cn) n N is an arithmetic progression; if f = q Z,h 1 = c Z,h 2 = 0 then (a n ) n N = (cq n ) n N is a geometric progression; if f = 1,h 1 = c Z,h 2 = q Z then (a n ) n N = ( n cqj ) n N is a sequence of partial sums of a geometric progression; if f = X,h 1 = 1,h 2 = 0 then (a n ) n N = (n!) n N is the sequence of factorials; if f = 2X + l,l {0,1},h 1 = 1,h 2 = 0 then (a n ) n N = ((2n+l)!!) n N is the sequence of double factorials. One can easily obtain the closed formula a n = n h 1(j)h 2 (j) j n i=j+1 f(i) for n N. A particular subclasses of R are class R of sequences for which h 2 = 1 and class R of sequences for which h 2 = 1. It is worth to note that if a = a(f,h 1, 1) = (a n ) n N then a n = ( 1) n ã n,n N, where ã = ã( f,h 1,1) = (ã n ) n N. Certainly the equality is true for n = 0. Now, assume that a n 1 = ( 1) n 1 ã n 1 for n > 0. Then a n = f(n)a n 1 +( 1) n h 1 (n) = ( 1) n ( f(n)ã n 1 + h 1 (n)) = ( 1) n ã n. The sequence ã we will call associated to the sequence a. Hence the study of such properties as: periodicity, p-adic valuations, divisors, boundedness for sequences from class R comes down to study of this properties for sequences from R. 4.1. Periodicity modulo d and p-adic valuations. 4.1.1. Periodicity modulo d, when h 2 = 1 or h 2 = 1 and d f(n 0 ) for some n 0 N. Assume that a = a(f,h 1,1). Let d N + be such that d f(n 0 ) for some n 0 N. Then for each n n 0 we have n n n n a n = h 1 (j) f(i) h 1 (j) f(i) (4) d 1 = i=j+1 j 1 h 1 (n j) j=n d+1 f(n i) (mod d). i=j+1 Making reduction modulo d we can skip the summands from 0th to (n d)th because if 0 j n d then among (at least d) numbers j +1,j +2,...,n there is such number i 0 that d f(i 0 ) and d n i=j+1 f(i). If n 0 n < d then f(n 0 ) appears in the product n i=j+1f(i) for n d+1 j < 0, thus this product has no influence on the value a n (mod d). Let us define f d = d 1 h 1(X j) j 1 f(x i) Z[X]. Then the equation (4) takes the form a n f d (n) (mod d),n n 0 and because of periodicity modulo d of any polynomial we conclude that the sequence (a n (mod d)) n Nn0 is periodic of period d. One can ask the natural question now: Is d the basic period of (a n

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS 13 (mod d)) n Nn0? If gcd(d,a n ) = 1 for some n N, f = b 1 X+b 0, where gcd(d,b 1 ) = 1 and h 1 = c Z then the answer is positive. Proposition 1. Let as assume a = a(b 1 X + b 0,c,1), where b 0,b 1,c Z. Let d N + divide b 1 n 0 +b 0 for some n 0 N and gcd(d,a n1 ) = 1 for some n 1 n 0. d Then the sequence (a n (mod d)) n Nn0 has the basic period divisible by gcd(d,b. In 1) particular, if gcd(d,b 1 ) = 1 then the basic period is equal to d. Proof. Denote the basic period of (a n (mod d)) n Nn0 by per. We thus obtain the following chain of equivalences: a n1+per+1 a n1+1 (mod d) (b 1 (n 1 +per+1)+b 0 )a n1+per +c (b 1 (n 1 +1)+b 0 )a n1 +c (mod d) (b 1 (n 1 +per+1)+b 0 )a n1 (b 1 (n 1 +1)+b 0 )a n1 (mod d) b 1 (n 1 +per+1)+b 0 b 1 (n 1 +1)+b 0 (mod d) b 1 (n 1 +per+1) b 1 (n 1 +1) (mod d) ( ) d n 1 +per+1 n 1 +1 mod gcd(d,b 1 ) per 0 ( mod Our proposition is proved. d gcd(d,b 1 ) ). Example 4. Let c be as in the statement of Proposition 1 and suppose that c > 1. Then by simple induction one can prove that c a n for all n N. In other words, the sequence (a n (mod c)) n N is constant and equal to 0. This means that the assumption gcd(d,a n1 ) = 1 for some n 1 n 0 in Proposition 1 is essential. Example 5. Let us fix c,d Z such that d > 1. Consider the sequence given by the formula a 0 = c,a n = (n ϕ(d)+1 n)a n 1 +c,n > 0 (by ϕ we mean Euler s totient function). By Euler s theorem d n ϕ(d)+1 n for all n N, hence the sequence (a n (mod c)) n N is constant and equal to c (mod d). Thus the assumption f = b 1 X+b 0 in Proposition 1 is essential. Example 6. Let us consider the sequence a = a(x, ax +a,1), where a Z. It is very easy to prove that a n = a for all n N. Hence the assumption h 1 = c in Proposition 1 is essential. The last example shows us that Proposition 1 is no longer true if we replace a constant polynomial h 1 = c with an affine polynomial h 1 = c 1 X +c 0. However, we can modify Proposition 1 and get the following. Proposition 2. Let a = a(b 1 X + b 0,c 1 X + c 0,1), where b 0,b 1,c 0,c 1 Z. Let d N + be such that d b 1 n 0 +b 0 for some n 0 N. Let us assume that gcd(d,b 1 a n1 + c 1 ) = 1 for some n 1 n 0. Then the sequence (a n (mod d)) n Nn0 has the basic period equal to d. Proof. Denote the basic period of (a n (mod d)) n Nn0 by per. We thus obtain the following chain of equivalences: a n1+per+1 a n1+1 (mod d) (b 1 (n 1 +per+1)+b 0 )a n1+per +c 1 (n 1 +per+1)+c 0 (b 1 (n 1 +1)+b 0 )a n1 +c 1 (n 1 +1)+c 0 (mod d) (b 1 (n 1 +per+1)+b 0 )a n1 +c 1 per (b 1 (n 1 +1)+b 0 )a n1 (mod d) b 1 a n1 per+c 1 per 0 (mod d) (b 1 a n1 +c 1 )per 0 (mod d).

14 PIOTR MISKA Since gcd(d,b 1 a n1 +c 1 ) = 1, we get d per and we are done. Let a = a(f,h 1, 1). Let us assume that d N + is such that d f(n 0 ) for some n 0 N. Then a n = ( 1) n ã n for each n N. This means that a n ( 1) n ã n (mod d) for all n N. Since ã = ã( f,h 1,1) and d f(n 0 ) we deduce that the sequence (ã n (mod d)) n Nn0 is periodic. If we denote the basic period of (ã n (mod d)) n Nn0 by per > 1 then (a n (mod d)) n Nn0 has the basic period equal to: per, when 2 per; 2per, when 2 per. If the sequence (ã n (mod d)) n Nn0 is constant then (a n (mod d)) n Nn0 has the basic period equal to: 1, when d a n,n n 0 or d = 2; 2, otherwise. In particular, since the associated sequence ( D n ) n N to the sequence of derangements satisfies the assumptions of the Proposition 1, hence ( D n (mod d)) n N has the basic period d for arbitrary d N + and as a result the basic period of (D n (mod d)) n N is equal to: d, when 2 d; 2d, when 2 d. Remark 2. It is worth to recall a well known fact that if (a n ) n N is a sequence of integers, d 1,d 2 are two coprime positive integers and the sequences(a n (mod d 1 )) n N, (a n (mod d 2 )) n N are periodic with basic periods per 1,per 2 respectively then the sequence (a n (mod d 1 d 2 )) n N is periodic with basic period lcm(per 1,per 2 ). 4.1.2. p-adic valuations of numbers a n,n N, when h 2 = 1 or h 2 = 1 and p f(n 0 ) for some n 0 N. Let us fix a prime number p and assume that a = a(f,h 1,1). If p f(n 0 ) for some n 0 N then for each k N + and n n 0 +(k 1)p we have n n n n a n = h 1 (j) f(i) h 1 (j) f(i) (5) = kp 1 i=j+1 j 1 h 1 (n j) j=n kp+1 i=j+1 f(n i) f p,k (n) (mod p k ), where f p,k = kp 1 h 1(X j) j 1 f(x i) Z[X]. We can skip the summands from 0th to (n kp)th because if 0 j n d then among (at least kp) numbers j + 1,j + 2,...,n there are at least k numbers congruent to n 0 modulo p, thus p divides at least k factors in product n i=j+1 f(i). Additionaly, if f(n 0) = 0 and n 0 n < n 0 +(k 1)p then n i=j+1 f(i) = 0 for j < n 0. Hence the congruence (5) is satisfied for n n 0. What is more, f p,k(n) = kp 1 j 1 j 1 [h 1(n j) f(n i)+h 1 (n j) (f (n s) j 1 [h 1(n j) 2p 1 j 1 f(n i)+h 1 (n j) s=0 s=0 (f (n s) j 1,i s j 1,i s f(n i))] f(n i))] (mod p). Hence (f p,k,1) k N2 is a pseudo-polynomial decomposition modulo p of a and thus we can use Theorem 1 to obtain the criterion for behavior of p-adic valuation of the number a n.

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS 15 Theorem 5. Assume that a = a(f,h 1,1). Let p be a prime number and k N +. Let f(n 0 ) = 0 (respectively p f(n 0 )) and n k n 0 (respectively n k n 0 +kp) be such that p k a nk. If v p (a nk +p a nk ) = 1 then there exists a unique n k+1 modulo p k+1 such that n k+1 n k (mod p k ) and p k+1 a n for all n n 0 (respectively n n 0 +kp) congruent to n k+1 modulo p k+1. Moreover, n k+1 n k pan k a nk +p a nk (mod p k+1 ). If v p (a nk +p a nk ) > 1 and p k+1 a nk then p k+1 a n for any n satisfying n n k (mod p k ) and n n 0 (respectively n n 0 +kp). If v p (a nk +p a nk ) > 1 and p k+1 a nk then p k+1 a n for any n satisfying n n k (mod p k ) and n n 0 (respectively n n 0 +kp). In particular, if k = 1, p a n1 and v p (a n1+p a n1 ) = 1 then for any l N + there exists a unique n l modulo p l such that n l n 1 (mod p) and v p (a n ) l for all n n 0 (respectively n n 0 + (l 1)p) congruent to n l modulo p l. Moreover, n l satisfies the congruence n l n l 1 pan l 1 a n1 +p a n1 (mod p l ) for l > 1. Proof. Note thatq p (n k ) = 1 p (a n k +p a nk ) (q p (n k ) is as in the statement of Theorem 1), which implies that v p (a nk +p a nk ) = v p (q p (n k ))+1. We use Theorem 1 for the set S = {n N : n n 0 } (respectively S = {n N : n n 0 +kp}) and get the result. Let us observe that if a R then v p (a n ) = v p (ã n ). Hence it suffices to apply Theorem 5 for the sequence ã in order to obtain the description of p-adic valuation of numbers a n, n N. 4.1.3. Prime divisors and p-adic valuations of the sequence of derangements. Theorem 5 can be used to describe p-adic valuations of numbers of derangements, but we will study these numbers more precisely. Namely, D n = nd n 1 +( 1) n = D n 1 +(n 1)D n 1 +( 1) n = (n 1)D n 2 +( 1) n 1 +(n 1)D n 1 +( 1) n = (n 1)(D n 2 +D n 1 ) for n > 1. We thus have n 1 D n for n N and as a consequence v p (n 1) v p (D n ) for each prime p. Let us define two sets: A = {p P : v p (n 1) = v p (D n ) for all n N}, B = P\A. Denote E n = Dn n 1 = D n 2 +D n 1,n > 1. Hence it suffices to study p-adic valuations of the sequence (E n ) n N2 forp B. Firstly note that the setb is infinite. Proposition 3. The set B is infinite. Proof. Assume that B = {p 1,...,p s }. Since (( 1) n D n (mod p) i ) n N has period p i for each i {1,...,s}, thus (( 1) n E n (mod p) i ) n N2 has period p i, too. Because E 2 = 1, hence p 1...p s E p1...p sm+2 for all m N. B is the set of all prime divisors of numbers E n,n > 1 and E n > 0 (because D n > 0 for n 1), so E p1...p sm+2 = 1 for E all m N. On the other hand, n (n 2)!n = Dn n! = n ( 1) j j! e 1, when n +. This fact implies that E n +, when n +, and this is a contradiction. For a given prime numberpit is easy to verify ifp A. Because of periodicity of the sequence (( 1) n E n (mod p)) n N2 it suffices to check that p divides none of the numbers E n, n {2,...,p+1}. The first numbers in A are 2,5,7,17,19,23,29. Numerical computations show that among all prime numbers less than 10 6 there are 28990 numbers which belong to A, while 49508 primes belong to B. This means that primes less than 10 6 contained in A are approx. 37% of all primes less than 10 6. However, we are not able to prove that the set A is infinite.

16 PIOTR MISKA Conjecture 1. The set A is infinite. Moreover, lim n + (A {1,...,n}) (P {1,...,n}) = 1 e. The following heuristic reasoning allows us to claim the second statement in the conjecture above. If we fix a prime number p and choose by random a sequence (a n ) n N such that the sequence of remainders (a n (mod p)) n N has period ( p then p. the probability thatpdoes not divide any term of this sequence is equal to 1 p) 1 When p + then this probability tends to 1 e. Note that p A if and only if p does not divide any number Ẽn, n 2 and the sequence (Ẽn (mod p)) n N2 is periodic of period p. Therefore we suppose that the probability that p A tends to 1 e, when p + and hence the asymptotic density of the set A in the set P is equal to 1 e. Now we are obtaining a pseudo-polynomial decomposition modulo p of the sequence (E n ) n N2. Note, that ( 1) n E n = ( 1) n D n 2 + ( 1) n D n 1 = D n 2 D n 1, n > 1. Let f p,k = kp 1 ( 1)j j 1 (X i), k > 1. Then (f p,k,1) k N2 is a pseudo-polynomial decomposition modulo p of ( D n ) n N (recall that D 0 = 1, D n = n D n 1 +1, n > 0). Hence (f p,k (X 2) f p,k (X 1),1) k N2 is a pseudopolynomial decomposition modulo p of (( 1) n E n ) n N2 and (f p,k (X 2) f p,k (X 1),( 1) n ) k N2 (where ( 1) n means the function which maps a nonnegative integer n to ( 1) n ) is a pseudo-polynomial decomposition modulo p of (E n ) n N2. Remark 3. We can define E 0,E 1 so that (E n ) n N has a pseudo-polynomial decomposition. The sequence of functions (f p,k ) k N2 converges uniformly to the function f p, = + ( 1)j j 1 (X i) on Z p and thus (see Section 3.2): so there must be: E n = ( 1) n (f p, (n 2) f p, (n 1)),n 2, E 0 = f p, ( 2) f p, ( 1) = + (j +1)! + + + E 1 = f p, (0) f p, ( 1) = 1 j! = j!. j=1 j! = 1, It is worth to remark that E 0 = D0 1. Thus the definition of E 0 coincides with the definition E n = Dn n 1 for n 2. One can observe that E 1 / Z. Indeed, if E 1 Z then the sequence of remainders (E 1 (mod n!)) n N or ( E 1 (mod n!)) n N is ultimately constant. However, for n > 1 we have n 1 E 1 (mod n!) = n! j! > n! (n 1)(n 1)! = (n 1)! and which leads to a contradiction. j=1 n 1 E 1 (mod n!) = j!, Theorem 6. Let p B,k N + and n k N, n k 2 be such that p k ( ) us define q p (n k ) = 1 Dnk +p p n k +p 1 + Dn k n k 1. j=1 D nk n k 1. Let If p q p (n k ) then there exists a unique n k+1 modulo p k+1 such that n k+1 n k (mod p k ) and p k+1 D n n 1 for all n 2 congruent to n k+1 modulo p k+1. D What is more, n k+1 n k + nk (n k 1) q p(n k ) (mod pk+1 ).

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS 17 If p q p (n k ) and p k+1 (mod p k ) and n 2. If p q p (n k ) and p k+1 (mod p k ) and n 2. In particular, if k = 1, p D nk n k 1 then pk+1 D nk n k 1 then pk+1 D n1 n 1 1 and p2 D n n 1 for all n satisfying n n k D n n 1 for any n satisfying n n k ( ) Dn1 +p n + Dn 1 1+p 1 n 1 1 then for any l N + ) l ( there exists a unique n l modulo p l such that n l n 1 (mod p) and v Dn p n 1 for all n 2 congruent to n l modulo p l. Moreover, n l satisfies the congruence n l n l 1 + D nl 1 (n l 1 1) q p(n 1) (mod pl ) for l > 1. Proof. Let q p (n k ) be as specified in Theorem 1. Note that q p (n k ) = 1 ( ) D nk +p p ( 1) n k+p (n k +p 1) D nk ( 1) n k (nk 1) ( = ( 1)n k+p Dnk +p p n k +p 1 + D ) n k = ( 1) nk q p (n k ), n k 1 where the equalities above hold, because p 2 (2 A). Thus v p ( q p (n k )) = Dn k n v p (q p (n k )) and if v p ( q p (n k )) = 0 then n k+1 n k k 1 ( 1) n kq p(n k ) = n D nk k+ (n k 1) q p(n k ) (mod p k+1 ). According to numerical computations based on the theorem above, among primes less than 10 6 there are three primes p with the property that there exists D an n 1 2 such that p n1 n and p q 1 1 p(n 1 ). Namely, they are: p = 2633 with n 1 = 1578, p = 429943 with n 1 = 317291, p = 480143 with n 1 = 121716. ( ) Dn1 In addition, if a tuple(p,n 1 ) is one of these tree tuples above thenv p n 1 1 = ( ) 1. Therefore, by Theorem 6, v Dn p = 1 for all integers n 2 congruent to n 1 D n n 1 n 1 modulo p. Since 2633 if and only if n 1578 (mod 2633), thus the 2633-adic valuation of numbers Dn n 1,n 2, is bounded by 1. D Forp = 480143 we have429943 n n 1 if and only ifn 172017,223393,317291 D (mod 429943) and 429943 q 429943 (172017), q 429943 (223393), and 480143 n n 1 if and only if n 121716,265745 (mod 480143) and 480143 q 480143 (265745), so the 429943-adic valuation and 480143-adic valuation of numbers Dn n 1,n 2, are unbounded. Hence it is not true that the p-adic valuation of numbers Dn n 1,n 2, is unbounded for all p B. In the light of these results it is natural to ask the following questions: Question 1. Are there infinitely many primes p with the property that there exists D n 1 N 2 such that p n1 n and p q 1 1 p(n 1 )? Question 2. Are there infinitely many primes p B such that the set { ( ) } Dn v p : n N 2 n 1 is finite?

18 PIOTR MISKA 4.1.4. Periodicity modulo d in case when d divides f(n 0 ) for some integer n 0 and h 2 is arbitrary. Proposition 4. Let us consider a sequence a(f,h 1,h 2 ). Let d N + and n 0 N be such that d f(n 0 ) and n 0 (p+1)v p (d) 1 for all primes p. Then the sequence (a n (mod d)) n Nn0 is periodic of period lcm{p ki i (p i 1) : i {1,2,...,s}}, where d = p k1 1... pks s is the factorization of the number d. In particular, the number d s (p i 1) is a period of (a n (mod d)) n Nn0. Proof. By Remark 2, it suffices to prove this fact for d = p k, where p is a prime number and k is a positive integer. For each n n 0 we have congruence similar to (4). (6) a n = = n h 1 (j)h 2 (j) j kp 1 n i=j+1 f(i) n j=n kp+1 h 1 (j)h 2 (j) j j 1 h 1 (n j)h 2 (n j) n j f(n i) (mod p k ). n i=j+1 f(i) Since n n 0, n 0 k(p+1) 1 and j kp 1, thus n j k and if p h 2 (n j) then p k h 2 (n j) n j. Let us define N = {n N : p h 2 (n)}. Then the congruence (6) takes the form a n 0 j kp 1,n j N j 1 h 1 (n j)h 2 (n j) n j f(n i) (mod p k ). If n 1 n 2 (mod p k (p 1)) then n 1 j N if and only if n 2 j N. Since n 1 n 2 (mod p k ), thus h 1 (n 1 j) h 1 (n 2 j) (mod p k ), h 2 (n 1 j) h 2 (n 2 j) (mod p k ) and f(n 1 j) f(n 2 j) (mod p k ) for any j N. Since n 1 n 2 (mod p k 1 (p 1)), hence by Euler s theorem h 2 (n 1 j) n1 j h 2 (n 2 j) n2 j (mod p k ) for j such that n 1 j N. Finally (7) a n1 0 j kp 1,n 1 j N 0 j kp 1,n 2 j N j 1 h 1 (n 1 j)h 2 (n 1 j) n1 j f(n 1 i) j 1 h 1 (n 2 j)h 2 (n 2 j) n2 j f(n 2 i) a n2 (mod p k ), which means that p k (p 1) is a period of the sequence (a n (mod p k )) n Nn0. Example 7. Let a = a(b,h 1,d), where h 1 Z[X], b,d Z and gcd(b,d) = 1. Then the sequence (a n (mod d)) n N = (b n a 0 ) n N has period λ(d) = lcm{p ki 1 i (p i 1) : i {1,2,...,s}}, where d = p k1 1... pks s is the factorization of the number d and λ is Carmichael s function. This means that in general lcm{p ki i (p i 1) : i {1,2,...,s}} is not the basic period of (a n (mod d)) n Nn0. Example 8. The sequence a = a(x,1,2) is the example that lcm{p ki i (p i 1) : i {1,2,...,s}} may be the basic period of (a n (mod d)) n Nn0, where d = p k1 1... pks s is the factorization of the number d. Namely, if d = 225 = 3 2 5 2 then the basic period of (a n (mod 225)) n N is equal to 900 = lcm{3 2 2,5 2 4}.

ARITHMETIC PROPERTIES OF THE SEQUENCE OF DERANGEMENTS 19 4.1.5. Periodicity modulo p k in case when p does not divide f(n) for any integer n. Now we are considering periodicity modulo p k of sequences given by the relation a 0 = h 1 (0),a n = f(n)a n 1 +h 1 (n)h 2 (n) n,n > 0, where h 2 Z[X] is an arbitrary polynomial and a prime number p does not divide f(n) for any integer n. Proposition 5. Let p be a prime number, k be a positive integer and a sequence a = a(f,h 1,h 2 ). Assume that p f(n) for any integer n. Then the sequence (a n (mod p k )) n Nk 1 is periodic of period of the form tp k (p 1), where t {1,2,3,...,p k }. Moreover, if p h 2 (n) for any integer n then the sequence (a n (mod p k )) n N is periodic of period of the form as above. If h 2 = 1 and p 2 then there is a period of the form 2tp k, t {1,2,3,...,p k }. If h 2 = 1 and p = 2 or h 2 = 1 then there is a period of the form tp k, t {1,2,3,...,p k }. Proof. Let us consider the numbersa k 1, a p k (p 1)+k 1,a 2p k (p 1)+k 1,...,a p k p k (p 1)+k 1. By pigeon hole principle there are s 1,s 2 {0,1,2,3,...,p k }, s 1 < s 2 such that a s1p k (p 1)+k 1 a s2p k (p 1)+k 1 (mod p k ). Let us put t = s 2 s 1. We will show that (8) a n a tp k (p 1)+n (mod p k ) for n k 1. The congruence (8) is satisfied for n = s 1 p k (p 1)+k 1. Assume now that k 1 n < s 1 p k (p 1)+k 1 and (8) is satisfied for n+1. Then we have f(n+1)a n +h 1 (n+1)h 2 (n+1) n+1 f(tp k (p 1)+n+1)a tpk (p 1)+n+ +h 1 (tp k (p 1)+n+1)h 2 (tp k (p 1)+n+1) tpk (p 1)+n+1 (mod p k ). Let us assume that p h 2 (n + 1). Then p h 2 (tp k (p 1) + n + 1). Since n+1 k, we infer that p k h 2 (n+1) n+1, p k h 2 (tp k (p 1)+n+1) tpk (p 1)+n+1. Suppose now that p h 2 (n + 1). Then p h 2 (tp k (p 1) + n + 1) and by Euler s theorem we obtain the following h 2 (tp k (p 1)+n+1) tpk (p 1)+n+1 h 2 (tp k (p 1)+n+1) n+1 h 2 (n+1) n+1 (mod p k ). Finally, we get h 1 (n+1)h 2 (n+1) n+1 h 1 (tp k (p 1)+n+1)h 2 (tp k (p 1)+n+1) tpk (p 1)+n+1 As a consequence we have (mod p k ). f(n+1)a n f(tp k (p 1)+n+1)a tp k (p 1)+n f(n+1)a tp k (p 1)+n (mod p k ). Moreover, the fact that p f(n+1) implies that a n a tpk (p 1)+n (mod p k ). Let us note that if p h 2 (n) for any integer n then the consideration above allows us to conclude that a n a tp k (p 1)+n (mod p k ) for any n {0,1,...,s 1 p k (p 1)+k 1}. Similarly we prove (8) for n > s 1 p k (p 1)+k 1. The proof in the cases h 2 = 1, h 2 = 1 runs in the same way: we consider the numbers a k 1, a 2p k +k 1, a 4p k +k 1,..., a 2p k p k +k 1 (respectively a k 1, a p k +k 1, a 2p k +k 1,..., a p k p k +k 1) and we use the fact that ( 1) n+1 h 1 (n+1) ( 1) 2tpk +n+1 h 1 (2tp k +n+1) (mod p k ) (respectively h 1 (n+1) h 1 (tp k +n+1) (mod p k )). Example 9. Let f = X 2 2, h 1 = 1, h 2 = 2, p = 5 and k = 1. Then the basic period of the sequence (a n (mod 5)) n N is equal to 100 = 5 2 4. Hence it is possible that the basic period of the sequence (a n (mod p k )) n Nk 1 is exactly p 2k (p 1).