{'fraction_non_alphanumeric': 0.043576446972231515, 'fraction_numerical': 0.01605888256942121, 'mean_word_length': 3.777067518977227, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Integer Codes Correcting Asymmetric Errors in Nand Flash Memory

: Memory devices based on ﬂoating-gate transistor have recently become dominant technology for non-volatile storage devices like USB ﬂash drives, memory cards, solid-state disks, etc. In contrast to many communication channels, the errors observed in ﬂash memory device use are not random but of special, mainly asymmetric, type. Integer codes which have proved their efﬁciency in many cases with asymmetric errors can be applied successfully to ﬂash memory devices, too. This paper presents a new construction and integer codes over a ring of integers modulo A = 2 n + 1 capable of correcting single errors of type ( 1,2 ) , ( ± 1, ± 2 ) , or ( 1,2,3 ) that are typical for ﬂash memory devices. The construction is based on the use of cyclotomic cosets of 2 modulo A . The parity-check matrices of the codes are listed for n ≤ 10.


Introduction
The NAND (NOT AND) logic type memory devices based on floating-gate transistor have recently become dominant technology for non-volatile storage devices like USB flash drives, memory cards, solid-state disk, etc. This technology has advantages regarding storage density, cost, power consumption and erase and write times but bytes cannot be addressed independently. The hierarchical structure of NAND flash is as follows: A series of NAND cells is connected in strings which are organized in pages, pages are organized in blocks and so on. This architecture requires reading and writing to be done only in pages. Moreover, before writing any data in a page of a block this block must be erased. Hence erasing is block-wise.
Data processing in NAND flash memories is realized by changing the voltage at inputs. The corresponding physical processes in the cells can generates errors in the work of the memory. Recently used technology for 3D NAND memory of vertically stacked cells additionally increases the probability of errors. Therefore, NAND flash memory requires error control coding. In many commercial flash memory devices classical error correcting codes are implemented, e.g., Hamming codes, BCH codes, Reed-Solomon codes. However, these codes are designed for channels where the errors with the same weight are equally probable, which is not true for flash memories.
Abstractly, flash memory can be considered as a device comprising blocks of "cells" that can take on a given number of different states (levels). The process of writing involves an increasing level of the cell or erasing the entire block before increasing the level of a cell in that block. Errors can be a wrong increase of the level or more rarely a decrease during the process of storage.
A mathematical model that describes well the processes in flash memory is the following. Let the cells have A states, that is, store log 2 (A) bits. Then we can consider pages and blocks as vectors over the ring Z A of integers modulo A. Then errors can be considered as changes of the values of vectors' entries. The aforesaid shows that usually changes of the entries of the vectors are in an upward direction but with limited-magnitude values.
Moreover, decreasing mainly with 1 is observed. Hence we can say that dominant errors are symmetric of type ±1 and (2, 3, . . . l) for a small l. This fact gives rise to the need to invent and study asymmetric limited-magnitude error correcting codes over Z A (known also as integer codes).
Asymmetric limited-magnitude error-correcting codes were proposed by Varshamov and Tenengolz [1,2] and in a more general form by Ahlswede et al. [3]. Another general method for constructionof asymmetric limited-magnitude error-correcting codes is provided by Cassuto et al. [4]. In 2011, T. Klove and B. Bose [5] proposed systematic codes that correct single limited-magnitude systematic asymmetric errors and achieve a higher rate than the ones given in [4]. They also showed how their code construction can be slightly modified to give codes correcting symmetric errors of limited magnitude. Later T. Klove et al. [6] extended their results and gave a necessary and sufficient condition for the existence of a code over GF(p) correcting a single asymmetric error.
In this paper we propose a constructions of codes over Z 2 n +1 correcting single asymmetric errors of type (1, 2), (±1, ±2) or (1, 2, 3). The argument A = 2 n + 1 is chosen due to the fact that it is the closest to, while greater than, a power of two. The choice of A is essential since the use of the unsuitable size of the alphabet can generate problems in implementation of encoding and decoding procedures. Moreover, as we shall see later, the proposed codes are perfect.
The next parts of the paper are organized as follows. A summary of existing results and necessary notations and definitions which are used in this paper are given in Section 2. In Section 3 new constructions of integer codes for flash memory are proposed. Concluding remarks and some open problems are presented and discussed in Section 4. In the Appendix, more detailed information about constructed codes is presented.

Preliminaries
Codes over finite alphabets of integers for correcting asymmetric errors are constructed in [1,2]. With the name "integer codes", such codes are applied to magnetic recording and frame synchronization in [7]. For that, time integer codes have been studied for various purposes and used in many applications. Coding for flash multilevel memory is an area they can be successfully applied to.
Let us recall basic definitions.

Definition 1.
Let Z A be the ring of integers modulo A. An integer code of length n with paritycheck matrix H ∈ Z m×n A is said to be a subset of Z n A , defined by where all zeros vector 0 ∈ Z m A . (We will write only C if there is no possibility for ambiguity.) We shall say that C is [n, n − m] A integer code. This notation is widely used for linear code with block length n and dimension n − m but in this paper it only means that H has m rows, n columns and entries from Z A . We remind the reader that if A is not a prime then C is not a linear subspace. It is a submodule whose properties, although very close to ones of linear subspaces, are different. In partial, the size of C may differ from A n−m . However the differences do not impact correcting properties of considered codes. The aforesaid notation is used only for convenience with no reference to the dimension of the code.
In contrast to conventional codes, integer codes are intended to correct specific types of errors. By choosing a proper parity-check matrix one can construct a code correcting specific types of errors like as given below.

Definition 2.
Let l j and k i be positive integers, j = 1, . . . , m, i = 1, . . . , s. The code C(H) is said to be a single (±k 1 , ±k 2 , . . . , ±k s , l 1 , l 2 , . . . , l m ) error correctable if it can correct any error vector with only one nonzero entry with value l j or ±k i .

Definition 3.
A single (±k 1 , ±k 2 , . . . , ±k s , l 1 , l 2 , . . . , l m ) error correctable code C(H) of block length n over Z A is called perfect if A = (2s + m)n + 1. If the size A of the alphabet is the minimal possible for which a single (±k 1 , ±k 2 , . . . , ±k s , l 1 , l 2 , . . . , l m ) error correctable code C(H) of block length n over Z A exists, we say that C is optimal.
For many parameters, perfect codes do not exist. In these cases the goal is to construct an optimal code.

New Construction of Integer Codes Correcting Single Error of Type
To construct a single error correctable code it is sufficient to find a parity-check matrix with one row, i.e., Such codes have only one parity-check symbol, i.e., the best possible rate (n − 1)/n. The syndrome corresponding to a single error e in position i is eh i . Therefore such a code can correct a single error e if all eh i are distinct. Proof. 2 n ≡ −1 (mod A) gives 2 2n ≡ 1 (mod A). Hence the order m of 2 modulo A is a divisor of 2n. The assumption m | n leads to 2 n ≡ 1 (mod A), which is a contradiction. Thus m = 2k, where k|n. Therefore the number of elements |A 1 | of A 1 is even. The same holds for one of any cyclotomic coset A s = {s2 i (mod A) | i = 0, 1, . . .} with (s, A) = 1. Now we shall show that the cardinality of A 1 is exactly 2n. If k < n then A = 2 n + 1 ≥ 2 2k The integer code with parity-check matrix H = (A 0 1 ) has length n and only one paritycheck equation, i.e., rate (n − 1)/n. The syndrome corresponding to a single error with value 1 is an element of A 0 1 . If the value is 2 the syndrome belongs to 2A 0 . Hence the syndromes are distinct.
A 00 s consists of first l elements of A 0 s for k odd and first l + 1 elements when k is even. The condition |A s | ≥ 8 guarantees that |A 00 s | ≥ 2 (the minimal possible size of H is 1 × 2). Hence the multiplication by (−1) maps A 00 s into the negative part of A 1 s when k is odd and into the negative part of A 0 s for even k. Multiplying by 2 maps it into the positive part of A 1 s , while multiplying by −2 maps it into the negative part of A 0 s , or A 1 s for k odd or even, respectively. Therefore syndromes are distinct.

Corollary 3. Using notation and conditions of Theorem 2 the code with
is a single (±1, ±2) error correctable code over A when |A s i | ≥ 4 and s i are distinct leaders.
Here are several properties of the numbers of the form 2 n + 1 that can be useful. Their proofs are straightforward and we omit them.
P1. If n has odd divisor d then 2 n d + 1 divides 2 n + 1. In partial if n is odd 3|(2 n + 1). P2. Let n = 2 a m, where m is odd positive integer. Then where F a = 2 2 a + 1 is Fermat number. F a is a prime for a = 0, 1, 2, 3, 4 (no other such primes are known) but even F 4 = 65,537 is too large for a divisor of practically interesting value of A.
Construction of single (1, 2, 3) error correctable codes. Construction of such codes strongly depends on the value of A = 2 n + 1 and we cannot formulate statement more general than the one in Corollary 2 but can formulate some principles to be followed when one searches such codes. The matrix H = (A 0 1 ) is the start point for construction. Next we have to enlarge the code by adding some A 0 i or A 1 i , taking into account the following simple observations

•
If A j = 3A i then A j has to be excluded. • For n odd 3 divides A and the situation 3A j = 3A i can happen. In this case if A 0 i is included in H then A j \ 3A 0 i (which is A 0 j or A 1 j ) can be included. For n even (3, A) = 1 and the considered situation is impossible. Table 1 presents parameters of the single error correctable codes constructed by our method over A = 2 n + 1 for 3 ≤ n ≤ 10 (the cases n = 1, 2 are trivial). The parity-check matrices are given in Examples 1-3 and in Appendix A.

Discussion
In this paper we consider only codes over Z A , A = 2 n + 1, with one parity-check equation that is sufficient for correction of a single error. There are constructions using matrices with more rows but they require more parity-check symbols; thus, they have a lower rate. Herein we construct codes only with a maximal rate.
Encoding is a computation of only one linear expression. Decoding can be done by using a syndrome error table. Both operations are very fast and simple for modern digital devices.
All codes correcting single (1, 2) error are perfect. The same holds for codes correcting (±1, ±2) error but only when n is even.
Parity-check matrices for n > 10 are too large to be presented in the paper although the fast development of technologies makes such parameters interesting for practice. However, the described construction algorithm is simple to realize and interested readers can easily construct and implement such codes.
Our further investigations aim to develop construction of codes over A = 2 n + 1 correcting two or more errors of the considered type. Examples of dou-ble error correctable codes can be found, for example, in [8,9], but they are not applicable to flash memories.