Questions tagged [luhn]

Luhn's Algorithm is a simple checksum formula used to generate the check digit in most credit card numbers.

The Luhn algorithm is well known with credit cards but is also used in various other applications like the IMEI for cell phones.

See: https://en.wikipedia.org/wiki/Luhn_algorithm

One of the exercises in the CS50 course (tag — also CS50 Stack Exchange) is implementing Luhn's Algorithm; the tag will often show up with the tag.

207 questions
0
votes
0 answers

C++ verify creditcard via LUHN Formula (Loop & SumToken Error)

I used to be coding with C#, I'm learning C++ at UOW currently. There's this assignment that im supposed to verify a credit card whether its valid via modulus 10 (LUHN formula) However I didn't manage to get the correct answer as displayed/required…
Marcus Moo
  • 196
  • 1
  • 2
  • 20
0
votes
0 answers

Mod10 Formula in Crystal Reports

On another forum I found this formula and it seems to work except that I keep getting 2 different errors First Error I get "A string is required here" error. I'm getting the error on line 8 (counting blank lines) of the code where it…
0
votes
1 answer

Luhn algorithm in Haskell

I think I have computed Luhn algorithm correctly in Haskell: f1 :: Integer -> [Integer] f1 x = if x < 10 then [x] else (f1 (div x 10))++[mod x 10] f2 :: [Integer] -> [Integer] f2 xs = [(!!) xs (x - 1) | x <- [1..(length xs)] , even x] f3 ::…
joseabp91
  • 305
  • 2
  • 8
0
votes
2 answers

How to generate Luhn Sequential numbers and save them in linux?

I was generating (19 digit) sequential numbers like this: seq 1234496713247997000 1234496713247998000 > seq_numbers.txt and then validating them online using a luhn checker. Instead of doing a two step approach, How can i do this in a like a bash…
Hopelessone
  • 337
  • 1
  • 12
0
votes
1 answer

Check a valid credit card number using python

This is a homework assignment that I've been working on to compute if a credit card number is valid. It has many steps and uses 2 other helper functions. The first helper function makes a list consisting of each digit in n: def intToList(n): …
thatoneguy
  • 73
  • 6
0
votes
2 answers

Luhn checksum method; separating two digits and finding the sum of that list

I am currently trying to use the luhn method to determine whether a credit card is valid or not in python and here is what I have so far: print('What is your Credit Card number? :) (please put a space between each number)') a = [int(x) for x in…
jgats
  • 25
  • 2
0
votes
2 answers

PL/SQL Check Digit, luhn using MOD 11

So here is the question: Write code to take in an id and determine if the check digit is correct UPDATED CODE: Set SERVEROUTPUT ON DECLARE val_num NUMBER := '&user_input'; holder NUMBER := 0; y NUMBER := 0; conv_string…
Jeff Mercier
  • 39
  • 1
  • 6
0
votes
1 answer

Validating credit card numbers in python

My code output is incorrect even though I can't see why.If anyone could shed some light on my problem, I would really appreciate it. For an assignment we are to allow the user to input a 15 or 16 digit credit card number and return whether the…
Rsherrill
  • 129
  • 3
  • 4
  • 12
0
votes
2 answers

Can't figure out the error Luhn check

Its supose to tell me if a card is valid or invalid using luhn check 4388576018402626 invalid 4388576018410707 valid but it keeps telling me that everything is invalid :/ Any tips on what to do, or where to look, would be amazing. I have been stuck…
user5467501
0
votes
1 answer

Credit Card Validation in Java with Luhn Algorithm with a string

I'm trying to create a method to validate a credit card number, but we have to process it as a string heres some information about my task... Credit card numbers follow certain patterns. A credit card must have between 13 and 16 digits. In 1954,…
R2S
  • 1
  • 2
0
votes
0 answers

OCR serial number check digit

I want to read a serial number of about 16-20 characters (A-Z, 0-9) with the help of OCR. Since all character won't be recognized correctly every time I want to add one check character to the serial number. At the moment I found the simple Luhn mod…
Mr.Sheep
  • 1,368
  • 1
  • 15
  • 32
0
votes
1 answer

Luhn's algorithm

a) Starting with the check digit and moving left, compute the sum of all the decoded digits. b) Compute the remainder of the sum using integer division by 10. If the result is not zero, the credit card number is invalid. Otherwise, the card number…
abcd248
  • 31
  • 1
  • 5
0
votes
3 answers

I am working with the Luhn Algorithm in Java for eimacs

This is for my AP Computer Programming class and I am lost at whats wrong with my code. My other programming teacher basically sees nothing wrong with my code and I've tried various different sets of code to work, but none have. This code, however…
0
votes
0 answers

Insert many records into a MySQL table with an AUTO_INCREMENT with a single query

I would like to be able to insert a large number of sequential records into a table with an AUTO_INCREMENT field, setting the value of another field to a constant value for all the inserted rows, using a single query. Example: CREATE TABLE…
mkopala
  • 1,262
  • 3
  • 12
  • 15
0
votes
1 answer

Luhn. Digit length control

I am really new to this. I am trying to use the Luhn Algorithm to validate a "person number" (a Swedish social security number). I think the code is almost finished but I don't know what to put in the class "birthDate.length()" and "pos" to make it…
Kangaroo
  • 9
  • 1
  • 5