Xah Talk Show 2025-12-15 Ep725 Wolfram Language, Advent of Code 2025, Day 2, Problem 2
Video Summary (Generated by AI, Edited by Human.)
- Here's a breakdown of the topics discussed in the video with their corresponding timestamps:
- Solving Advent of Code 2025, Day 2, Problem 2 with Wolfram Language: (0:03)
- Discussion and Review of the Ultimate Hacking Keyboard 80 (UHK80): (0:16)
- Introduction to Wolfram Language for Programmers: (1:21)
- Comparison of Wolfram Language with AI Chatbots (like ChatGPT): (4:40)
- Wolfram Language's Advanced Capabilities for Mathematical Computations: (3:05)
- Wolfram Language for Handling Complex Scientific and Data-Driven Queries: (7:29)
- Problem Description: Identifying Numbers with Repeated Digit Sequences: (17:17)
- Limitations of Advent of Code Problem Specifications (lack of maximum digit info): (29:39)
- Impact of Undefined Maximum Digits on Coding Solutions: (30:01)
- Is Ultimate Hacking Keyboard 80 (UHK80) worth buying, vs Kinesis Freestyle and Glove 80 and others (40:26).
- Solution using Regular Expressions with Test Cases: (55:00-55:51)
- Solve Advent of Code 2025, Day 2, Problem 2 using Wolfram Language (0:03).
- Problem: identifying numbers that are sequences of digits repeated at least twice (17:17).
- Wolfram Language vs AI chatbots ChatGPT. (1:21) (4:40).
- Highlights Wolfram Language's advanced capabilities for mathematical computations (3:05) and its ability to handle complex scientific and data-driven queries (7:29).
- Chatbots are more versatile for general questions (6:03), Wolfram Language provides more accurate and technical information for scientific problems (1:51).
- Is Ultimate Hacking Keyboard 80 (UHK80) worth buying (0:16), vs Kinesis Freestyle and Glove 80 and others (40:50).
- Insights on factors to consider when purchasing an expensive keyboard, such as price, portability, and desired features (45:00).
- criticism of Advent of Code (29:39). e.g. no mention of the maximum number of digits in the input, which affects the approach to coding solutions (30:01).
- Near the end, shown solution is just one line of code, at the core is a regular expression (55:00-55:51).
- Wolfram language vs ai chatbot
- https://youtu.be/W2C4oaU3-yo?t=280
- Wolfram Language for Programers
- Wolfram: Download Wolfram Engine
- Emacs: Xah Wolfram Mode 📦
- Emacs: Xah Fly Keys 📦
Code
xinput = "8123221734-8123333968,2665-4538,189952-274622,4975-9031,24163352-24202932,1233-1772,9898889349-9899037441,2-15,2147801-2281579,296141-327417,8989846734-8989940664,31172-42921,593312-632035,862987-983007,613600462-613621897,81807088-81833878,13258610-13489867,643517-782886,986483-1022745,113493-167913,10677-16867,372-518,3489007333-3489264175,1858-2534,18547-26982,16-29,247-366,55547-103861,57-74,30-56,1670594-1765773,76-129,134085905-134182567,441436-566415,7539123416-7539252430,668-1146,581563513-581619699";
StringMatchQ[ "121212" , RegularExpression[ "(\\d+)\\1"] ] (* False *) StringMatchQ[ "121212" , RegularExpression[ "(\\d+)\\1\\1" ] ] (* True *) StringMatchQ[ "121212" , RegularExpression[ "((\\d+)\\1\\1)" ] ] (* False *) StringMatchQ[ "121212" , RegularExpression[ "(\\d+)\\1|(\\d+)\\1\\1" ] ] (* False *) (* s------------------------------ *) StringMatchQ[ "121212" , RegularExpression[ "(\\d+)\\1\\1" ] ] (* True *) StringMatchQ[ "121212" , RegularExpression[ "(?:(\\d+)\\1\\1)" ] ] (* True *) (* s------------------------------ *) StringMatchQ[ "121212" , RegularExpression[ "(\\d+)\\1{1,20}" ] ] (* True *) StringMatchQ[ "12121212" , RegularExpression[ "(\\d+)\\1{1,20}" ] ] (* True *) StringMatchQ[ "1212" , RegularExpression[ "(\\d+)\\1{1,20}" ] ] (* True *) StringMatchQ[ "12123" , RegularExpression[ "(\\d+)\\1{1,20}" ] ] (* False *) (* s------------------------------ *)
(* xinput = "11-22,95-115,998-1012,1188511880-1188511890,222220-222224,1698522-1698528,446443-446449,38593856-38593862,565653-565659,824824821-824824827,2121212118-2121212124"; *) xinput = "8123221734-8123333968,2665-4538,189952-274622,4975-9031,24163352-24202932,1233-1772,9898889349-9899037441,2-15,2147801-2281579,296141-327417,8989846734-8989940664,31172-42921,593312-632035,862987-983007,613600462-613621897,81807088-81833878,13258610-13489867,643517-782886,986483-1022745,113493-167913,10677-16867,372-518,3489007333-3489264175,1858-2534,18547-26982,16-29,247-366,55547-103861,57-74,30-56,1670594-1765773,76-129,134085905-134182567,441436-566415,7539123416-7539252430,668-1146,581563513-581619699"; xsplitedInput = StringSplit[xinput,","]; newInputList = Map[ Function[x, Apply[Range , Map[ ToExpression, StringSplit[x,"-"]]] ] , xsplitedInput]; Total @ Flatten @ Map[ Function[xnumberList, Select[xnumberList, Function[x, StringMatchQ[ ToString[x] , RegularExpression[ "(\\d+)\\1{1,20}" ] ]] ]] , newInputList ] (* 76169125915 *)
xinput = "11-22,95-115,998-1012,1188511880-1188511890,222220-222224,1698522-1698528,446443-446449,38593856-38593862,565653-565659,824824821-824824827,2121212118-2121212124"; Total @ Flatten @ Map[ Function[xnumberList, Select[xnumberList, Function[x, StringMatchQ[ ToString[x] , RegularExpression[ "(\\d+)\\1{1,20}" ] ]] ]] , Map[ Function[x, Apply[Range , Map[ ToExpression, StringSplit[x,"-"]]] ] , StringSplit[xinput,","]] ] (* 4174379265 *) (* s------------------------------ *) (* shortcut syntax *) Total @ Flatten @ ((Select[#, Function[x, StringMatchQ[ ToString[x] , RegularExpression[ "(\\d+)\\1{1,20}" ] ]] ] &) /@ ((Range @@ Map[ ToExpression, StringSplit[#,"-"]] &) /@ StringSplit[xinput,","]) ) (* 4174379265 *)
Advent of Code 2025
- Xah Talk Show 2025-12-08 Ep720 Wolfram Language, Advent of Code 2025, Day 1
- Xah Talk Show 2025-12-09 Ep721 Wolfram Language, Advent of Code 2025, Day 1, Problem 2
- Xah Talk Show 2025-12-11 Ep723 Wolfram Language, Advent of Code 2025, Day 1, Problem 2, take 2
- Xah Talk Show 2025-12-12 Ep724 Wolfram Language, Advent of Code 2025, Day 2
- Xah Talk Show 2025-12-15 Ep725 Wolfram Language, Advent of Code 2025, Day 2, Problem 2
- Xah Talk Show 2025-12-17 Ep726 Wolfram Language, Advent of Code 2025, Day 3 (aborted)
- Xah Talk Show 2025-12-18 Ep727 Wolfram Language, Advent of Code 2025, Day 3, take 2
- Xah Talk Show 2025-12-19 Ep728 Wolfram Language, Advent of Code 2025, Day 3, part 2 (failed)
- Xah Talk Show 2025-12-20 Ep729 Wolfram Language, Advent of Code 2025, Day 4
- Xah Talk Show 2025-12-21 Ep730 Wolfram Language, Advent of Code 2025, Day 4, take 2
- Xah Talk Show 2025-12-22 Ep731 Wolfram Language, Advent of Code 2025, Day 4, part 2. Wolfram vs SageMath
- Xah Talk Show 2025-12-23 Ep732 Wolfram Language, Advent of Code 2025, Day 4, part 2. take 2
- Xah Talk Show 2025-12-26 Ep733 Wolfram Language, Advent of Code 2025, Day 5
- Xah Talk Show 2025-12-27 Ep734 Wolfram Language, Advent of Code 2025, Day 5, part 2